@documental-xyz/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +424 -0
  2. package/integration.ts +113 -0
  3. package/package.json +83 -0
  4. package/src/admin/admin.astro +29 -0
  5. package/src/assets/scripts/App.js +70 -0
  6. package/src/assets/scripts/EnteringAnimations.js +34 -0
  7. package/src/assets/scripts/MapBoxHandler.js +680 -0
  8. package/src/assets/scripts/ScrollProgressionBar.js +24 -0
  9. package/src/assets/scripts/utils/ScrollObserver.js +166 -0
  10. package/src/assets/styles/config/_breakpoints.scss +37 -0
  11. package/src/assets/styles/config/_colors.scss +8 -0
  12. package/src/assets/styles/config/_config.scss +5 -0
  13. package/src/assets/styles/config/_functions.scss +90 -0
  14. package/src/assets/styles/config/_grrr.configs.scss +7 -0
  15. package/src/assets/styles/config/_mixins.scss +207 -0
  16. package/src/assets/styles/config/_type.scss +175 -0
  17. package/src/assets/styles/config/_vars.scss +16 -0
  18. package/src/assets/styles/globals/_content.scss +47 -0
  19. package/src/assets/styles/globals/_grrr.scss +18 -0
  20. package/src/assets/styles/globals/_html.scss +25 -0
  21. package/src/assets/styles/globals/_lists.scss +19 -0
  22. package/src/assets/styles/globals/_map-anchors.scss +32 -0
  23. package/src/assets/styles/globals/_reset.scss +240 -0
  24. package/src/assets/styles/globals/_reveal-animations.scss +104 -0
  25. package/src/assets/styles/globals/_root.scss +6 -0
  26. package/src/assets/styles/globals/_scroll-progression-bar.scss +8 -0
  27. package/src/assets/styles/main.scss +17 -0
  28. package/src/assets/styles/utils/.gitkeep +0 -0
  29. package/src/assets/styles/utils/grrr/_grrr.scss +433 -0
  30. package/src/assets/styles/utils/list-styles/_list-styles.scss +190 -0
  31. package/src/components/AnimationToggle.astro +19 -0
  32. package/src/components/BigNumbers.astro +83 -0
  33. package/src/components/Button.astro +49 -0
  34. package/src/components/Caption.astro +15 -0
  35. package/src/components/Card.astro +68 -0
  36. package/src/components/Cards.astro +66 -0
  37. package/src/components/CardsCall.astro +125 -0
  38. package/src/components/ChartBar.astro +217 -0
  39. package/src/components/ChartPercentage.astro +137 -0
  40. package/src/components/Column.astro +54 -0
  41. package/src/components/ColumnSticky.astro +129 -0
  42. package/src/components/Columns.astro +139 -0
  43. package/src/components/Compare.astro +266 -0
  44. package/src/components/Cta.astro +242 -0
  45. package/src/components/Gallery.astro +594 -0
  46. package/src/components/Group.astro +140 -0
  47. package/src/components/HtmlEmbed.astro +98 -0
  48. package/src/components/ImageBlock.astro +134 -0
  49. package/src/components/InnerColumns.astro +54 -0
  50. package/src/components/LogosGroup.astro +102 -0
  51. package/src/components/Map.astro +321 -0
  52. package/src/components/MapBox.astro +96 -0
  53. package/src/components/MapView.astro +30 -0
  54. package/src/components/Menu.astro +278 -0
  55. package/src/components/Pullquote.astro +46 -0
  56. package/src/components/Slider.astro +223 -0
  57. package/src/components/Spacer.astro +25 -0
  58. package/src/components/Text.astro +173 -0
  59. package/src/components/TextPlaceholder.astro +98 -0
  60. package/src/components/Timeline.astro +73 -0
  61. package/src/components/TimelineBullet.astro +67 -0
  62. package/src/components/VideoEmbed.astro +99 -0
  63. package/src/content/loader.ts +29 -0
  64. package/src/content/pages/alter-ameacada.md +80 -0
  65. package/src/content/pages/expulsions.md +1447 -0
  66. package/src/content/pages/home.md +346 -0
  67. package/src/content/pages/nhanderekoa-studio-autonoma.md +3113 -0
  68. package/src/content/pages/nhanderekoa-terra-ind/303/255gena-jaragu/303/241.md +3806 -0
  69. package/src/content/pages/nova-landing-page.md +546 -0
  70. package/src/content/pages/territ/303/263rios-de-exce/303/247/303/243o.md +2199 -0
  71. package/src/content/pages/teste-alter-do-chao.md +955 -0
  72. package/src/content/pages/teste-layout.md +1484 -0
  73. package/src/content/pages/thiago.md +93 -0
  74. package/src/content/schema/blog.ts +11 -0
  75. package/src/content/schema/geostorys.ts +13 -0
  76. package/src/content/schema/index.ts +3 -0
  77. package/src/content/schema/pages.ts +494 -0
  78. package/src/content.config.ts +49 -0
  79. package/src/env.d.ts +1 -0
  80. package/src/integration/override-aliases.ts +67 -0
  81. package/src/layouts/components/ButtonLayout.astro +8 -0
  82. package/src/layouts/components/CardLayout.astro +8 -0
  83. package/src/layouts/components/CardsCallLayout.astro +26 -0
  84. package/src/layouts/components/CardsLayout.astro +14 -0
  85. package/src/layouts/components/ChartBarLayout.astro +21 -0
  86. package/src/layouts/components/ChartPercentageLayout.astro +17 -0
  87. package/src/layouts/components/ColumnLayout.astro +11 -0
  88. package/src/layouts/components/ColumnStickyLayout.astro +10 -0
  89. package/src/layouts/components/ColumnsLayout.astro +13 -0
  90. package/src/layouts/components/CompareLayout.astro +22 -0
  91. package/src/layouts/components/CtaLayout.astro +91 -0
  92. package/src/layouts/components/GalleryLayout.astro +24 -0
  93. package/src/layouts/components/GroupLayout.astro +53 -0
  94. package/src/layouts/components/HtmlEmbedLayout.astro +18 -0
  95. package/src/layouts/components/ImageBlockLayout.astro +20 -0
  96. package/src/layouts/components/InnerColumnsLayout.astro +14 -0
  97. package/src/layouts/components/LogosGroupLayout.astro +22 -0
  98. package/src/layouts/components/MapLayout.astro +41 -0
  99. package/src/layouts/components/MapViewLayout.astro +8 -0
  100. package/src/layouts/components/MapboxLayout.astro +248 -0
  101. package/src/layouts/components/PullquoteLayout.astro +13 -0
  102. package/src/layouts/components/SliderLayout.astro +18 -0
  103. package/src/layouts/components/SpacerLayout.astro +8 -0
  104. package/src/layouts/components/TextLayout.astro +17 -0
  105. package/src/layouts/components/TextPlaceholderLayout.astro +7 -0
  106. package/src/layouts/components/TimelineBulletLayout.astro +14 -0
  107. package/src/layouts/components/TimelineLayout.astro +10 -0
  108. package/src/layouts/components/VideoEmbedLayout.astro +28 -0
  109. package/src/layouts/pages/Layout.astro +90 -0
  110. package/src/layouts/pages/PageLayout.astro +200 -0
  111. package/src/lib/collections.ts +1 -0
  112. package/src/routes/[slug].astro +17 -0
  113. package/src/routes/index.astro +5 -0
  114. package/src/vite/yaml-merge-plugin.ts +234 -0
@@ -0,0 +1,321 @@
1
+ ---
2
+ import MapView from "./MapView.astro";
3
+
4
+ const { columnAlign, floatingText, txtColor, bgColor, mapView, components } = Astro.props;
5
+
6
+ let content = await Astro.slots.render("default");
7
+ content = floatingText ? content.replace(/<br[^>]*>/g, '<b r></b>') : content;
8
+
9
+ // Buscar componentes MapView dentro dos components
10
+ const mapViewComponents = components ? components.filter(comp => comp.type === 'MapView') : [];
11
+
12
+ //columnAlign recebe left || right || center
13
+ //floatingText recebe booleano
14
+ //mapView recebe o id da layer do mapa, inserido nas configuracões
15
+
16
+ ---
17
+
18
+ <section
19
+ class:list={[
20
+ "map",
21
+ `map--align${columnAlign}`,
22
+ floatingText && `map--floating-text`,
23
+ ]}
24
+ >
25
+ <div class="map__holder">
26
+ <div class="map__content" set:html={content}></div>
27
+ </div>
28
+ </section>
29
+
30
+ <style lang="scss" define:vars={{ "clr-txt": txtColor, "clr-bg": bgColor }}>
31
+ @use "../assets/styles/globals/grrr" as *;
32
+ @use "../assets/styles/config/config" as *;
33
+ @use "../assets/styles/utils/grrr/grrr" as *;
34
+
35
+ .map {
36
+ $self: &;
37
+ min-height: 100vh;
38
+ @extend %grrr--board;
39
+ color: var(--clr-txt);
40
+
41
+ @include media-break-down(l) {
42
+ display: block;
43
+ margin-top: var(--map-height-mobile);
44
+ position: relative;
45
+
46
+ &::after {
47
+ content: "";
48
+ display: block;
49
+ min-height: 100vh;
50
+ }
51
+
52
+
53
+ &--floating-text{
54
+ z-index: 100;
55
+ margin-top: 0;
56
+ &::after{
57
+ display: none;
58
+ }
59
+ }
60
+
61
+ &:not(#{$self}--floating-text) + #{$self}:after{
62
+ display: none;
63
+ }
64
+ }
65
+
66
+ @include media-break-up(xl) {
67
+ display: block;
68
+ }
69
+
70
+ &__view {
71
+ position: absolute;
72
+ left: 20px;
73
+ z-index: 9999;
74
+ border-bottom: 1px solid;
75
+ border-left: 1px dashed;
76
+ color: yellow;
77
+ height: 1px;
78
+ padding-left: 10px;
79
+ opacity: 0;
80
+ max-width: 200px;
81
+
82
+ &.odd {
83
+ color: #59ff4d;
84
+ }
85
+ }
86
+
87
+ &__holder {
88
+ position: relative;
89
+ width: 100%;
90
+ min-height: 100vh;
91
+ background-color: var(--clr-bg);
92
+ padding-inline: var(--atnl-gutter, 40px);
93
+
94
+ @include media-break-down(l) {
95
+ padding-block: var(--mt-m);
96
+ &:not(#{$self}--floating-text &){
97
+ position: sticky;
98
+ top: var(--map-height-mobile);
99
+ margin-top: calc(var(--map-height-mobile) * -1);
100
+ min-height: calc(100vh - var(--map-height-mobile));
101
+ }
102
+ }
103
+
104
+ @include media-break-up(l) {
105
+ padding-block: 240px var(--mt-l);
106
+ }
107
+
108
+ @include media-break-up(xl) {
109
+ width: 100%;
110
+ max-width: 507px;
111
+ }
112
+
113
+ #{$self}--alignright & {
114
+ @include media-break-up(l) {
115
+ grid-column: board-end 8 / full-end;
116
+ }
117
+
118
+ @include media-break-up(xl) {
119
+ margin-left: auto;
120
+ }
121
+ }
122
+
123
+ #{$self}--alignleft & {
124
+ @include media-break-up(l) {
125
+ grid-column: full-start 1 / board-start 5;
126
+ }
127
+ }
128
+
129
+ #{$self}--aligncenter & {
130
+ @include media-break-up(l) {
131
+ grid-column: board-full;
132
+ }
133
+ }
134
+
135
+ #{$self}--floating-text & {
136
+ background-color: transparent;
137
+ }
138
+
139
+ #{$self}--aligncenter & {
140
+ max-width: 664px;
141
+ margin-inline: auto;
142
+ }
143
+ }
144
+
145
+ &__content {
146
+ position: relative;
147
+
148
+ #{$self}--floating-text & {
149
+ :global(> *:not(div):not(.image)),
150
+ :global(> .text > *) {
151
+ display: inline;
152
+ background-color: var(--clr-bg);
153
+ padding: 0.2em 0;
154
+ position: relative;
155
+
156
+ &:not(:first-child) {
157
+ &::before {
158
+ content: "";
159
+ height: var(--mt-s);
160
+ white-space: pre;
161
+ display: block;
162
+ position: relative;
163
+ z-index: 2;
164
+ }
165
+ }
166
+
167
+ :global([r]) {
168
+ display: block;
169
+ }
170
+
171
+ :global([r] + [r]) {
172
+ height: 100%;
173
+ }
174
+
175
+ :global([r]:before) {
176
+ height: 100%;
177
+ }
178
+ }
179
+
180
+ :global(body:not(.is-safari)) & :global(> *:not(div):not(figure)),
181
+ :global(body:not(.is-safari)) & :global(> .text > *) {
182
+ padding: 0.2em 5px;
183
+ margin-left: -5px;
184
+ margin-right: -150vw;
185
+ -webkit-box-decoration-break: clone;
186
+ box-decoration-break: clone;
187
+ }
188
+ }
189
+ }
190
+
191
+ :global(#captions) {
192
+ max-width: 310px;
193
+ position: fixed;
194
+ left: 40px;
195
+ color: var(--clr-txt);
196
+ background-color: var(--clr-bg);
197
+ padding: 16px;
198
+ border-radius: 3px;
199
+ transition: .3s ease;
200
+
201
+
202
+ &.hidden,
203
+ &:has(> button:first-child:last-child) {
204
+ opacity: 0;
205
+ }
206
+
207
+ @include media-break-down(l) {
208
+ width: calc(100% - 90px);
209
+ max-height: calc(var(--map-height-mobile) - 40px);
210
+ padding: 12px;
211
+ top: 20px;
212
+ left: 20px;
213
+ z-index: 3;
214
+ overflow-y: auto;
215
+ pointer-events: none;
216
+ background-color: transparent;
217
+
218
+ &::before {
219
+ content: '';
220
+ height: 45px;
221
+ width: 100%;
222
+ display: block;
223
+ background-color: var(--clr-bg);
224
+ position: sticky;
225
+ top: 0;
226
+ left: 0;
227
+ opacity: 0;
228
+ transform: translateY(-12px);
229
+ transition: .3s ease;
230
+ }
231
+
232
+ &[open] {
233
+ background-color: var(--clr-bg);
234
+ pointer-events: all;
235
+
236
+ :global(.captions__item) {
237
+ opacity: 1;
238
+ }
239
+
240
+ &::before {
241
+ opacity: 1;
242
+ transition-delay: .3s;
243
+ }
244
+ }
245
+ }
246
+
247
+ @include media-break-up(l) {
248
+ bottom: 33px;
249
+ }
250
+ }
251
+
252
+ :global(.captions__item) {
253
+ display: flex;
254
+ gap: 10px;
255
+ transition: .3s ease;
256
+
257
+ @include media-break-down(l) {
258
+ opacity: 0;
259
+ }
260
+
261
+ :global(span:has([class*="material-symbols"])) {
262
+ display: flex;
263
+ }
264
+
265
+ :global(+ .captions__item) {
266
+ margin-top: 10px;
267
+ }
268
+ }
269
+
270
+ :global(button) {
271
+ padding: 0;
272
+ border: none;
273
+ outline: 0;
274
+ background-color: transparent;
275
+
276
+ @include media-break-down(l) {
277
+ position: fixed;
278
+ top: 32px;
279
+ left: 32px;
280
+ pointer-events: all;
281
+ }
282
+
283
+ @include media-break-up(l) {
284
+ display: none;
285
+ }
286
+
287
+ :global(svg) {
288
+ pointer-events: none;
289
+ display: block;
290
+ }
291
+
292
+ :global(rect) {
293
+ fill: var(--clr-bg);
294
+ }
295
+
296
+ :global(path) {
297
+ fill: var(--clr-txt);
298
+ }
299
+ }
300
+
301
+ &--aligncenter :global(#captions),
302
+ &--alignleft :global(#captions) {
303
+ @include media-break-up(l) {
304
+ left: auto;
305
+ right: 40px;
306
+ }
307
+ }
308
+ }
309
+ </style>
310
+
311
+ <script>
312
+ window.addEventListener('click', e => {
313
+ const target = e.target as HTMLTextAreaElement;
314
+ if(!target.closest('[data-toggle-caption]')) return;
315
+
316
+ const toggleCaptionBtn = target.closest('[data-toggle-caption]');
317
+ const caption = toggleCaptionBtn.closest('#captions');
318
+
319
+ caption.toggleAttribute('open', !caption.hasAttribute('open'));
320
+ });
321
+ </script>
@@ -0,0 +1,96 @@
1
+ ---
2
+ import { Image } from 'astro:assets';
3
+ import MapboxLayout from "../layouts/components/MapboxLayout.astro";
4
+
5
+ const { mapboxData } = Astro.props;
6
+
7
+ const Fragment = 'div';
8
+ ---
9
+
10
+ <MapboxLayout Component={Fragment} props={{ mapboxData }}>
11
+ <div id="mapbox"></div>
12
+ <div id="mapbox-clone"><div></div></div>
13
+ </MapboxLayout>
14
+
15
+ <style lang="scss">
16
+ @use "../assets/styles/config/config" as *;
17
+
18
+ #mapbox {
19
+ position: fixed;
20
+ inset: 0;
21
+ z-index: 0;
22
+ pointer-events: none;
23
+ height: 100%;
24
+ width: 100%;
25
+ transition: opacity 1s ease;
26
+ opacity: 0;
27
+ background-color: black;
28
+
29
+ @include media-break-down(l) {
30
+ font-size: 60px;
31
+ }
32
+
33
+ img {
34
+ width: 100%;
35
+ height: 100%;
36
+ object-fit: cover;
37
+ }
38
+
39
+ :global(#mapbox.mobile .map) {
40
+ --map-height-mobile: 52vh;
41
+ margin-top: var(--map-height-mobile);
42
+ position: relative;
43
+
44
+ &::after {
45
+ content: "";
46
+ display: block;
47
+ min-height: 100vh;
48
+ }
49
+
50
+ & + .map::after {
51
+ display: none;
52
+ }
53
+ }
54
+
55
+ :global(.mapboxgl-ctrl-bottom-left),
56
+ :global(.mapboxgl-ctrl-bottom-right) {
57
+ display: none;
58
+ }
59
+ }
60
+
61
+ #mapbox-clone{
62
+ position: fixed;
63
+ height: var(--map-height-mobile);
64
+ overflow: hidden;
65
+ width: 100%;
66
+ z-index: 3;
67
+ pointer-events: none;
68
+
69
+ @include media-break-up(l) {
70
+ display: none;
71
+ }
72
+
73
+ div{
74
+ min-height: 100vh;
75
+ transition: opacity 1s ease;
76
+ opacity: 0;
77
+ background-color: black;
78
+ }
79
+ }
80
+
81
+ </style>
82
+
83
+ <script is:inline>
84
+ if (typeof window.mapConfig === 'undefined') {
85
+ console.warn('MapBox: window.mapConfig não foi definido. Verifique se os dados do mapbox estão configurados na página.');
86
+ }
87
+
88
+ if (typeof window.mapBoxToken === 'undefined') {
89
+ console.warn('MapBox: window.mapBoxToken não foi definido. Verifique se o token está configurado na página.');
90
+ }
91
+
92
+ if (typeof window.mapViews === 'undefined') {
93
+ console.warn('MapBox: window.mapViews não foi definido. Verifique se as views estão configuradas na página.');
94
+ window.mapViews = {};
95
+ }
96
+ </script>
@@ -0,0 +1,30 @@
1
+ ---
2
+ const { mapView, txtColor, bgColor } = Astro.props;
3
+ //mapView recebe o id da layer
4
+ ---
5
+
6
+ <div class="map-view" data-map-view={mapView} style={{ color: txtColor, backgroundColor: bgColor }}></div>
7
+
8
+ <style>
9
+ .map-view{
10
+ border-top: 1px solid;
11
+ color: yellow;
12
+ height: 1px;
13
+ max-height: 1px;
14
+ }
15
+ </style>
16
+
17
+ <script>
18
+ // Validar se a view existe no mapbox quando o componente é carregado
19
+ document.addEventListener('DOMContentLoaded', () => {
20
+ const mapViewElement = document.querySelector('[data-map-view]');
21
+ if (mapViewElement && (window as any).mapViews) {
22
+ const viewId = mapViewElement.getAttribute('data-map-view');
23
+ if (!(window as any).mapViews[viewId]) {
24
+ console.warn(`MapView: View "${viewId}" não encontrada nas views do mapbox disponíveis:`, Object.keys((window as any).mapViews));
25
+ } else {
26
+ console.log(`MapView: View "${viewId}" encontrada e válida`);
27
+ }
28
+ }
29
+ });
30
+ </script>
@@ -0,0 +1,278 @@
1
+ ---
2
+ const { languages, menu, sideLink, title } = Astro.props;
3
+ ---
4
+
5
+ <div class="topbar">
6
+ <div class="topbar__holder">
7
+ {title && <h1 class="topbar__title">{title}</h1>}
8
+ <button class="topbar__menu-btn" aria-controls="menu">
9
+ <span></span>
10
+ </button>
11
+ </div>
12
+
13
+ <nav id="menu" class="menu" aria-hidden="true">
14
+ {languages && (
15
+ <ul class="menu__top">
16
+ {languages.map(lang => <li><a href={lang.url}>{lang.slug}</a></li>)}
17
+ </ul>
18
+ )}
19
+ {menu && (
20
+ <ul class="menu__main">
21
+ {menu.map(item => <li><a href={item.url} target={item.target}>{item.text}</a></li>)}
22
+ </ul>
23
+ )}
24
+
25
+ {sideLink && <a href={sideLink.url} class="menu__side-link">DOCUMENTAL.XYZ</a>}
26
+
27
+ <button class="menu__close" aria-controls="menu">
28
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
29
+ <rect y="28.2842" width="40" height="4" transform="rotate(-45 0 28.2842)" fill="#F0EAD9"/>
30
+ <rect width="40" height="4" transform="matrix(-0.707107 -0.707107 -0.707107 0.707107 31.1133 28.2842)" fill="#F0EAD9"/>
31
+ </svg>
32
+ </button>
33
+ </nav>
34
+ </div>
35
+
36
+ <style lang="scss">
37
+ @use "../assets/styles/config/config" as *;
38
+ @use "../assets/styles/utils/grrr/grrr" as *;
39
+
40
+ .topbar {
41
+ $self: &;
42
+ @extend %grrr--board;
43
+ display: block;
44
+ width: 100%;
45
+ position: fixed;
46
+ top: 0;
47
+ left: 0;
48
+ height: 60px;
49
+ z-index: 200;
50
+ transition: background .3s ease;
51
+ pointer-events: none;
52
+
53
+ :global(body:has(.gallery-modal[aria-hidden="false"])) & {
54
+ opacity: 0;
55
+ pointer-events: none;
56
+ }
57
+
58
+ &.-hidden {
59
+ #{$self}__title {
60
+ opacity: 0;
61
+ }
62
+
63
+ :global(body[menu-open]) & #{$self}__title {
64
+ opacity: 1;
65
+ }
66
+ }
67
+
68
+ &.-fixed {
69
+ &:has(#{$self}__title) {
70
+ background-color: var(--clr-txt);
71
+ color: var(--clr-bg);
72
+ }
73
+
74
+ #{$self}__title {
75
+ opacity: 1;
76
+ }
77
+ }
78
+
79
+ @include media-break-up(l) {
80
+ padding-top: 50px;
81
+ }
82
+
83
+ &__title {
84
+ @include type('h-s');
85
+ font-weight: 500;
86
+ position: absolute;
87
+ left: var(--atnl-margin);
88
+ top: 50%;
89
+ transform: translateY(-50%);
90
+ transition: opacity .3s ease;
91
+
92
+ @include media-break-up(l) {
93
+ @include type('h-l');
94
+ font-weight: 500;
95
+ }
96
+ }
97
+
98
+ &__menu-btn {
99
+ width: 40px;
100
+ height: 20px;
101
+ display: flex;
102
+ flex-direction: column;
103
+ justify-content: space-between;
104
+ position: absolute;
105
+ right: var(--atnl-margin);
106
+ top: 50%;
107
+ transform: translateY(-50%);
108
+ background-color: transparent;
109
+ border: none;
110
+ padding: 0;
111
+ margin: 0;
112
+ pointer-events: all;
113
+
114
+ &:hover {
115
+ &::before {
116
+ width: 38px;
117
+ }
118
+
119
+ &::after {
120
+ width: 100%;
121
+ }
122
+
123
+ span {
124
+ width: 30px;
125
+ }
126
+ }
127
+
128
+ &::before, &::after, span {
129
+ content: '';
130
+ display: block;
131
+ width: 100%;
132
+ height: 2px;
133
+ background-color: currentColor;
134
+ transition: width .3s ease;
135
+ }
136
+
137
+ &::before {
138
+ width: 36px;
139
+ }
140
+
141
+ &::after {
142
+ width: 28px;
143
+ }
144
+ }
145
+ }
146
+
147
+ .menu {
148
+ @include type('h-xs');
149
+ width: 100%;
150
+ height: 100dvh;
151
+ max-width: 470px;
152
+ color: var(--clr-bg);
153
+ background-color: var(--clr-txt);
154
+ padding: var(--atnl-margin);
155
+ position: absolute;
156
+ top: 0;
157
+ right: 0;
158
+ transform: translateX(100%);
159
+ transition: .8s ease;
160
+ text-transform: uppercase;
161
+ pointer-events: all;
162
+
163
+ a, button {
164
+ @media (hover: "hover") {
165
+ &:hover {
166
+ opacity: .7;
167
+ }
168
+ }
169
+ }
170
+
171
+ &[aria-hidden="false"] {
172
+ transform: translateX(0);
173
+ }
174
+
175
+ &__top {
176
+ display: flex;
177
+ gap: 30px;
178
+ }
179
+
180
+ &__main {
181
+ width: calc(100% - 70px);
182
+ max-height: calc(100% - 40px);
183
+ padding-bottom: 40px;
184
+ padding-top: 56px;
185
+ padding-right: 30px;
186
+ display: flex;
187
+ flex-direction: column;
188
+ gap: 28px;
189
+ text-wrap: balance;
190
+ overflow: auto;
191
+ mask-image: linear-gradient(to top, transparent 0%, black 40px);
192
+ }
193
+
194
+ &__close {
195
+ position: absolute;
196
+ top: 30px;
197
+ right: var(--atnl-margin);
198
+ background-color: transparent;
199
+ border: none;
200
+ padding: 0;
201
+ margin: 0;
202
+
203
+ rect {
204
+ fill: currentColor;
205
+ }
206
+ }
207
+
208
+ &__side-link {
209
+ width: fit-content;
210
+ @include type('c-m');
211
+ font-weight: 700;
212
+ display: block;
213
+ position: absolute;
214
+ top: 120px;
215
+ right: 40px;
216
+ transform-origin: right center;
217
+ transform: rotate(-90deg) translateY(-65%);
218
+ }
219
+ }
220
+ </style>
221
+
222
+ <script>
223
+ //modal
224
+ function toggleMenu() {
225
+ const triggers = document.querySelectorAll('[aria-controls="menu"]');
226
+
227
+ triggers.forEach(trigger => {
228
+ trigger.addEventListener('click', e => {
229
+ e.preventDefault();
230
+
231
+ const targetId = trigger.getAttribute('aria-controls');
232
+ const target = document.querySelector(`#${targetId}`);
233
+ const targetState = target.getAttribute('aria-hidden')
234
+
235
+ target.setAttribute('aria-hidden', targetState === "true" ? "false" : "true");
236
+
237
+ if(document.body.hasAttribute('menu-open')) {
238
+ document.body.removeAttribute('menu-open');
239
+ } else {
240
+ document.body.setAttribute('menu-open', '');
241
+ }
242
+ })
243
+ })
244
+ }
245
+
246
+ function toggleFixedMenu() {
247
+ let lastScroll = window.scrollY || document.documentElement.scrollTop;
248
+ const scrollUpThreshold = 5;
249
+ const offset = 100;
250
+ const topBar = document.querySelector('.topbar');
251
+
252
+ window.addEventListener('scroll', e => {
253
+ const scrollTop = window.scrollY || document.documentElement.scrollTop;
254
+
255
+
256
+ if(scrollTop > offset) {
257
+ topBar.classList.add('-hidden');
258
+
259
+ if (lastScroll - scrollTop > scrollUpThreshold) {
260
+ topBar.classList.add('-fixed');
261
+ }
262
+
263
+ if(scrollTop - lastScroll > scrollUpThreshold) {
264
+ topBar.classList.remove('-fixed');
265
+ }
266
+ } else {
267
+ topBar.classList.remove('-hidden', '-fixed');
268
+
269
+ return;
270
+ }
271
+
272
+ lastScroll = scrollTop <= 0 ? 0 : scrollTop;
273
+ });
274
+ }
275
+
276
+ toggleFixedMenu();
277
+ toggleMenu();
278
+ </script>