@hyvor/design 2.1.8-beta.2 → 2.1.8-beta.3

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.
@@ -0,0 +1,353 @@
1
+ <script lang="ts">
2
+ import Button from '../../components/Button/Button.svelte';
3
+ import IconChevronDown from '@hyvor/icons/IconChevronDown';
4
+ import type { ComponentProps, Snippet } from 'svelte';
5
+
6
+ type ButtonProps = ComponentProps<typeof Button>;
7
+
8
+ interface Props {
9
+ title: string | Snippet;
10
+ subtitle?: string | Snippet;
11
+ badge?: string | Snippet;
12
+ buttons?: ButtonProps | ButtonProps[] | null;
13
+ accentColor?: string;
14
+ accentColorDark?: string;
15
+ fullHeight?: boolean;
16
+ after?: Snippet;
17
+ }
18
+
19
+ let {
20
+ title,
21
+ subtitle,
22
+ badge,
23
+ buttons = null,
24
+ accentColor,
25
+ accentColorDark,
26
+ fullHeight = false,
27
+ after
28
+ }: Props = $props();
29
+
30
+ const buttonList = $derived(buttons ? (Array.isArray(buttons) ? buttons : [buttons]) : []);
31
+ </script>
32
+
33
+ <section
34
+ class="hero"
35
+ class:full-height={fullHeight}
36
+ style:--hero-accent={accentColor}
37
+ style:--hero-accent-dark={accentColorDark}
38
+ >
39
+ <svg class="hero-pattern" aria-hidden="true" focusable="false">
40
+ <defs>
41
+ <pattern id="hero-dot-pattern" width="28" height="28" patternUnits="userSpaceOnUse">
42
+ <circle cx="2" cy="2" r="1.6" fill="currentColor" />
43
+ </pattern>
44
+ </defs>
45
+ <rect width="100%" height="100%" fill="url(#hero-dot-pattern)" />
46
+ </svg>
47
+
48
+ <div class="hds-container inner">
49
+ <div class="left">
50
+ {#if badge}
51
+ <div class="badge anim anim-0">
52
+ {#if typeof badge === 'string'}
53
+ {badge}
54
+ {:else}
55
+ {@render badge()}
56
+ {/if}
57
+ </div>
58
+ {/if}
59
+
60
+ <h1 class="anim anim-1">
61
+ {#if typeof title === 'string'}
62
+ {@html title}
63
+ {:else}
64
+ {@render title()}
65
+ {/if}
66
+ </h1>
67
+
68
+ {#if subtitle}
69
+ <h2 class="subtitle anim anim-2">
70
+ {#if typeof subtitle === 'string'}
71
+ {@html subtitle}
72
+ {:else}
73
+ {@render subtitle()}
74
+ {/if}
75
+ </h2>
76
+ {/if}
77
+
78
+ {#if buttonList.length}
79
+ <div class="buttons anim anim-3">
80
+ {#each buttonList as b}
81
+ <Button
82
+ as="a"
83
+ href={b.href}
84
+ target={b.external ? '_blank' : undefined}
85
+ rel={b.external ? 'noopener' : undefined}
86
+ size={b.size || 'x-large'}
87
+ variant={b.variant}
88
+ >
89
+ {b.label}
90
+ </Button>
91
+ {/each}
92
+ </div>
93
+ {/if}
94
+
95
+ {#if after}
96
+ <div class="anim anim-3">
97
+ {@render after()}
98
+ </div>
99
+ {/if}
100
+ </div>
101
+ </div>
102
+
103
+ <div class="scroll-indicator anim anim-4" aria-hidden="true">
104
+ <div class="scroll-mouse">
105
+ <div class="scroll-dot"></div>
106
+ </div>
107
+ <IconChevronDown size={12} />
108
+ </div>
109
+ </section>
110
+
111
+ <style>
112
+ .hero {
113
+ --hero-accent-resolved: var(--hero-accent, var(--accent));
114
+
115
+ position: relative;
116
+ display: flex;
117
+ align-items: center;
118
+ padding: 60px 0 80px;
119
+ overflow: hidden;
120
+ }
121
+
122
+ .hero.full-height {
123
+ min-height: calc(100vh - var(--header-height, 60px));
124
+ }
125
+
126
+ :global(:root.dark) .hero {
127
+ --hero-accent-resolved: var(--hero-accent-dark, var(--hero-accent, var(--accent)));
128
+ }
129
+
130
+ .hero-pattern {
131
+ position: absolute;
132
+ inset: 0;
133
+ width: 100%;
134
+ height: 100%;
135
+ color: var(--border);
136
+ mask-image: radial-gradient(ellipse 65% 60% at 50% 38%, black 0%, transparent 75%);
137
+ -webkit-mask-image: radial-gradient(ellipse 65% 60% at 50% 38%, black 0%, transparent 75%);
138
+ pointer-events: none;
139
+ }
140
+
141
+ .inner {
142
+ position: relative;
143
+ z-index: 1;
144
+ display: flex;
145
+ align-items: center;
146
+ gap: 100px;
147
+ width: 1120px;
148
+ max-width: 100%;
149
+ }
150
+
151
+ .left {
152
+ flex: 1;
153
+ min-width: 0;
154
+ text-align: center;
155
+ }
156
+
157
+ .badge {
158
+ display: inline-flex;
159
+ align-items: center;
160
+ gap: 6px;
161
+ padding: 4px 12px;
162
+ border-radius: 100px;
163
+ font-size: 13px;
164
+ font-weight: 600;
165
+ background: color-mix(in srgb, var(--hero-accent-resolved) 12%, transparent);
166
+ color: var(--hero-accent-resolved);
167
+ margin-bottom: 24px;
168
+ border: 1px solid color-mix(in srgb, var(--hero-accent-resolved) 25%, transparent);
169
+ }
170
+
171
+ h1 {
172
+ margin: 0;
173
+ font-size: clamp(36px, 5vw, 56px);
174
+ line-height: 1.1;
175
+ letter-spacing: -0.02em;
176
+ font-weight: 800;
177
+ font-family: var(--font-serif);
178
+ }
179
+
180
+ /* smaller second line inside the title, e.g. a parenthetical sub-line */
181
+ .left :global(h1 .heading-small) {
182
+ font-size: clamp(35px, 5vw, 46px);
183
+ font-weight: 800;
184
+ }
185
+
186
+ .subtitle {
187
+ font-weight: 500;
188
+ letter-spacing: -0.02em;
189
+ font-family: var(--font-serif);
190
+
191
+ margin: auto;
192
+ margin-top: 30px;
193
+ font-size: clamp(22px, 3vw, 26px);
194
+ line-height: 1.6;
195
+ color: color-mix(in srgb, var(--text) 70%, var(--text-light));
196
+ max-width: 480px;
197
+ }
198
+
199
+ .left :global(.hds-hl) {
200
+ color: var(--hero-accent-resolved);
201
+ font-weight: 700;
202
+ }
203
+
204
+ .left :global(.hds-marker) {
205
+ position: relative;
206
+ font-weight: 700;
207
+ background-image: linear-gradient(
208
+ 100deg,
209
+ color-mix(in srgb, var(--hero-accent-resolved) 35%, transparent) 0%,
210
+ color-mix(in srgb, var(--hero-accent-resolved) 45%, transparent) 100%
211
+ );
212
+ background-repeat: no-repeat;
213
+ background-size: 100% 0.5em;
214
+ background-position: 0 88%;
215
+ box-decoration-break: clone;
216
+ -webkit-box-decoration-break: clone;
217
+ }
218
+
219
+ .buttons {
220
+ display: flex;
221
+ gap: 12px;
222
+ margin-top: 36px;
223
+ flex-wrap: wrap;
224
+ justify-content: center;
225
+ }
226
+
227
+ /* Entrance animation */
228
+ .anim {
229
+ opacity: 0;
230
+ animation: hero-fade-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
231
+ }
232
+
233
+ .anim-0 {
234
+ animation-delay: 0s;
235
+ }
236
+
237
+ .anim-1 {
238
+ animation-delay: 0.05s;
239
+ }
240
+
241
+ .anim-2 {
242
+ animation-delay: 0.15s;
243
+ }
244
+
245
+ .anim-3 {
246
+ animation-delay: 0.25s;
247
+ }
248
+
249
+ .anim-4 {
250
+ animation-delay: 0.6s;
251
+ }
252
+
253
+ @keyframes hero-fade-up {
254
+ from {
255
+ opacity: 0;
256
+ transform: translateY(18px);
257
+ }
258
+ to {
259
+ opacity: 1;
260
+ transform: translateY(0);
261
+ }
262
+ }
263
+
264
+ @media (prefers-reduced-motion: reduce) {
265
+ .anim {
266
+ animation: none;
267
+ opacity: 1;
268
+ transform: none;
269
+ }
270
+ }
271
+
272
+ /* Scroll indicator */
273
+ .scroll-indicator {
274
+ position: absolute;
275
+ left: 50%;
276
+ bottom: 28px;
277
+ transform: translateX(-50%);
278
+ z-index: 1;
279
+ display: flex;
280
+ flex-direction: column;
281
+ align-items: center;
282
+ gap: 8px;
283
+ color: var(--text-light);
284
+ }
285
+
286
+ .scroll-mouse {
287
+ width: 24px;
288
+ height: 38px;
289
+ border: 2px solid var(--border);
290
+ border-radius: 100px;
291
+ display: flex;
292
+ justify-content: center;
293
+ padding-top: 6px;
294
+ }
295
+
296
+ .scroll-dot {
297
+ width: 4px;
298
+ height: 8px;
299
+ border-radius: 2px;
300
+ background: var(--hero-accent-resolved);
301
+ animation: scroll-wheel 1.8s ease-in-out infinite;
302
+ }
303
+
304
+ @keyframes scroll-wheel {
305
+ 0% {
306
+ opacity: 1;
307
+ transform: translateY(0);
308
+ }
309
+ 60% {
310
+ opacity: 0;
311
+ transform: translateY(12px);
312
+ }
313
+ 100% {
314
+ opacity: 0;
315
+ transform: translateY(12px);
316
+ }
317
+ }
318
+
319
+ @media (prefers-reduced-motion: reduce) {
320
+ .scroll-dot {
321
+ animation: none;
322
+ }
323
+ }
324
+
325
+ /* Responsive */
326
+ @media (max-width: 992px) {
327
+ .hero.full-height {
328
+ min-height: unset;
329
+ }
330
+
331
+ .hero {
332
+ padding: 60px 0;
333
+ }
334
+
335
+ .inner {
336
+ flex-direction: column;
337
+ gap: 48px;
338
+ text-align: center;
339
+ }
340
+
341
+ .subtitle {
342
+ max-width: 100%;
343
+ }
344
+
345
+ .buttons {
346
+ justify-content: center;
347
+ }
348
+
349
+ .scroll-indicator {
350
+ display: none;
351
+ }
352
+ }
353
+ </style>
@@ -0,0 +1,16 @@
1
+ import Button from '../../components/Button/Button.svelte';
2
+ import type { ComponentProps, Snippet } from 'svelte';
3
+ type ButtonProps = ComponentProps<typeof Button>;
4
+ interface Props {
5
+ title: string | Snippet;
6
+ subtitle?: string | Snippet;
7
+ badge?: string | Snippet;
8
+ buttons?: ButtonProps | ButtonProps[] | null;
9
+ accentColor?: string;
10
+ accentColorDark?: string;
11
+ fullHeight?: boolean;
12
+ after?: Snippet;
13
+ }
14
+ declare const Hero: import("svelte").Component<Props, {}, "">;
15
+ type Hero = ReturnType<typeof Hero>;
16
+ export default Hero;