Skip to content

Commit cb76595

Browse files
committed
feature: add scroll snap
1 parent f5c5bcd commit cb76595

2 files changed

Lines changed: 30 additions & 5 deletions

File tree

src/layouts/index.astro

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ const avatar: AvatarProps = {
2626
description={BRAND.description}
2727
keywords='películas, ver películas, películas online, películas en línea, películas completas, películas en streaming, series, ver series, series online, series en línea, series completas, series en streaming, lucas hoz, hoz lucas, lucashoz, hozlucas, hozlucas28'
2828
pageURL={pageURL}
29+
classes={{
30+
html: 'snap-y snap-mandatory',
31+
body: {
32+
main: {
33+
wrapper:
34+
'[:is(&_astro-island)]:*:snap-center [:not(&_astro-island)]:snap-center [:is(&_astro-island)]:*:scroll-my-12 [:not(&_astro-island)]:scroll-my-12',
35+
},
36+
},
37+
}}
2938
>
3039
<Header
3140
{avatar}

src/layouts/template.astro

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,24 @@ interface Props {
1616
description: string
1717
keywords: string
1818
pageURL: Page
19+
20+
classes?: Partial<{
21+
html: string
22+
body: Partial<{
23+
root: string
24+
main: Partial<{
25+
root: string
26+
wrapper: string
27+
}>
28+
}>
29+
}>
1930
}
2031
21-
const { locale, title, description, keywords, pageURL } = Astro.props
32+
const { locale, title, description, keywords, pageURL, classes } = Astro.props
2233
---
2334

2435
<html
25-
class={THEME.default}
36+
class:list={[THEME.default, classes?.html]}
2637
dir='ltr'
2738
lang={locale}
2839
>
@@ -241,11 +252,16 @@ const { locale, title, description, keywords, pageURL } = Astro.props
241252
</script>
242253
</head>
243254

244-
<body class='relative h-full font-sans antialiased'>
255+
<body class:list={['relative h-full font-sans antialiased', classes?.body?.root]}>
245256
<slot name='header' />
246257

247-
<main class='mx-auto w-full max-w-7xl pt-16 md:pt-[4.5rem] 2xl:max-w-(--breakpoint-2xl)'>
248-
<div class='mx-4'>
258+
<main
259+
class:list={[
260+
'mx-auto w-full max-w-7xl pt-16 md:pt-[4.5rem] 2xl:max-w-(--breakpoint-2xl)',
261+
classes?.body?.main?.root,
262+
]}
263+
>
264+
<div class:list={['mx-4', classes?.body?.main?.wrapper]}>
249265
<slot />
250266
</div>
251267
</main>

0 commit comments

Comments
 (0)