Skip to content

Commit 9b7403e

Browse files
authored
Merge pull request #2 from OnoSendae/feat/scroll-adjust
Refactor layout structure by adding a content wrapper for improved st…
2 parents 316e927 + 312fe9b commit 9b7403e

4 files changed

Lines changed: 97 additions & 26 deletions

File tree

_layouts/default.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242
</aside>
4343

4444
<div class="main-container">
45-
<main class="content">
46-
{% include breadcrumbs.html %}
47-
{{ content }}
48-
</main>
45+
<div class="content-wrapper">
46+
<main class="content">
47+
{% include breadcrumbs.html %}
48+
{{ content }}
49+
</main>
50+
</div>
4951
</div>
5052
</div>
5153

@@ -56,6 +58,7 @@
5658
<script src="{{ '/assets/js/progress-tracker.js' | relative_url }}"></script>
5759
<script src="{{ '/assets/js/analytics.js' | relative_url }}"></script>
5860
<script src="{{ '/assets/js/theme-toggle.js' | relative_url }}"></script>
61+
<script src="{{ '/assets/js/fix-content-height.js' | relative_url }}"></script>
5962
<script>
6063
window.siteData = {
6164
modules: {{ site.data.modules.modules | jsonify }},

_layouts/lesson.html

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,6 @@ <h1>{{ page.title }}</h1>
6666
{% include lesson-navigation.html %}
6767
</nav>
6868

69-
<section class="exercises">
70-
<h2>Exercícios Práticos</h2>
71-
{% if page.exercises %}
72-
{% for exercise_id in page.exercises %}
73-
{% assign exercise = site.data.exercises.exercises | where: "id", exercise_id | first %}
74-
{% if exercise %}
75-
<div class="exercise-card">
76-
<h3>{% if exercise.title %}{{ exercise.title }}{% else %}{{ exercise.slug | replace: '-', ' ' | capitalize }}{% endif %}</h3>
77-
<a href="{{ exercise.url | relative_url }}">Ver exercício</a>
78-
</div>
79-
{% endif %}
80-
{% endfor %}
81-
{% endif %}
82-
</section>
83-
8469
<script src="{{ '/assets/js/podcast-player.js' | relative_url }}"></script>
8570
<script src="{{ '/assets/js/video-player.js' | relative_url }}"></script>
8671

assets/js/fix-content-height.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
(function() {
2+
'use strict';
3+
4+
function fixContentHeight() {
5+
const contentWrapper = document.querySelector('.content-wrapper');
6+
const content = document.querySelector('.main-container .content');
7+
8+
if (!contentWrapper || !content) {
9+
return;
10+
}
11+
12+
// Aguardar o conteúdo carregar completamente
13+
setTimeout(() => {
14+
// Obter a altura real do conteúdo (com scale aplicado)
15+
const contentHeight = content.scrollHeight;
16+
// Calcular a altura visual (80% devido ao scale 0.8)
17+
const visualHeight = contentHeight * 0.8;
18+
// Ajustar o wrapper para cortar o espaço extra
19+
contentWrapper.style.height = visualHeight + 'px';
20+
contentWrapper.style.overflow = 'hidden';
21+
}, 100);
22+
23+
// Recalcular quando imagens ou outros recursos carregarem
24+
window.addEventListener('load', () => {
25+
setTimeout(() => {
26+
const contentHeight = content.scrollHeight;
27+
const visualHeight = contentHeight * 0.8;
28+
contentWrapper.style.height = visualHeight + 'px';
29+
}, 200);
30+
});
31+
}
32+
33+
// Executar quando o DOM estiver pronto
34+
if (document.readyState === 'loading') {
35+
document.addEventListener('DOMContentLoaded', fixContentHeight);
36+
} else {
37+
fixContentHeight();
38+
}
39+
})();
40+

assets/main.scss

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ body {
225225
flex-direction: row !important;
226226
align-items: flex-start !important;
227227
width: 100% !important;
228-
min-height: calc(100vh - 80px);
229228
box-sizing: border-box;
230229
margin: 0;
231230
padding: 0;
@@ -257,14 +256,53 @@ body {
257256
padding: 0;
258257
}
259258

259+
.main-container .content-wrapper {
260+
width: 100%;
261+
max-width: $container-max-width;
262+
overflow: hidden;
263+
position: relative;
264+
}
265+
260266
.main-container .content {
261267
max-width: $container-max-width;
262268
width: 100%;
263269
padding: $spacing-lg;
264270
box-sizing: border-box;
265-
transform: scale(0.8);
266-
transform-origin: top left;
267-
margin-bottom: -20%;
271+
zoom: 0.8;
272+
padding-bottom: $spacing-lg;
273+
display: block;
274+
275+
> *:last-child {
276+
margin-bottom: 0 !important;
277+
}
278+
279+
.exercises {
280+
margin-bottom: 0 !important;
281+
padding-bottom: 0 !important;
282+
283+
> *:last-child {
284+
margin-bottom: 0 !important;
285+
}
286+
}
287+
288+
section:last-child,
289+
.exercises:last-child,
290+
nav:last-child,
291+
.lesson-navigation:last-child {
292+
margin-bottom: 0 !important;
293+
padding-bottom: 0 !important;
294+
}
295+
296+
article:last-child,
297+
.lesson-content:last-child {
298+
margin-bottom: 0 !important;
299+
padding-bottom: 0 !important;
300+
}
301+
302+
.lesson-actions {
303+
margin-bottom: 0 !important;
304+
padding-bottom: 0 !important;
305+
}
268306
}
269307

270308
.container {
@@ -591,7 +629,7 @@ body {
591629
}
592630

593631
.lesson-navigation {
594-
margin: $spacing-xl 0;
632+
margin: $spacing-xl 0 0 0;
595633
padding: $spacing-lg;
596634
background: var(--color-bg-secondary);
597635
border-radius: 8px;
@@ -613,6 +651,8 @@ body {
613651

614652
.exercises {
615653
margin-top: $spacing-xl;
654+
margin-bottom: 0;
655+
padding-bottom: 0;
616656

617657
h2 {
618658
font-size: $font-size-h2;
@@ -708,9 +748,12 @@ body {
708748
height: auto;
709749
}
710750

751+
.main-container .content-wrapper {
752+
overflow: visible;
753+
}
754+
711755
.main-container .content {
712-
transform: scale(1);
713-
margin-bottom: 0;
756+
zoom: 1;
714757
}
715758

716759
.container {

0 commit comments

Comments
 (0)