File tree 4 files changed +53
-41
lines changed
4 files changed +53
-41
lines changed Original file line number Diff line number Diff line change 71
71
style ={` grid-template-columns: repeat(${cols }, minmax(0, 1fr)); ` }
72
72
on:mount
73
73
>
74
- <slot />
74
+ <slot columns ={ cols } />
75
75
</Container >
76
76
77
77
<!--<svelte:window on:resize={calculateRows} />-->
Original file line number Diff line number Diff line change 13
13
const topSelectable = useRegistrar ();
14
14
15
15
function handleGoBack() {
16
- // if ('willLeaveContainer' in detail) {
17
- // if (detail.direction !== 'left' || !detail.willLeaveContainer) return;
18
- // detail.preventNavigation();
19
- // }
20
-
21
16
const selectable = get (topSelectable );
22
17
if (selectable && get (selectable .focusIndex ) === 0 ) {
23
18
history .back ();
32
27
selectable ?.focusChild (0 , { cycleTo: true }) || selectable ?.focus ({ cycleTo: true });
33
28
} else handleGoBack ();
34
29
}
35
-
36
- // onDestroy(() => background.destroy())
37
30
</script >
38
31
39
32
<Container
Original file line number Diff line number Diff line change 22
22
23
23
<Container
24
24
on:back ={handleGoBack }
25
- on:mount ={registrar }
26
- class =" *:px-32 flex flex-col h-screen relative"
25
+ class =" py-16 *:px-32 flex flex-col h-screen overflow-y-auto overflow-x-hidden"
27
26
>
28
- <div
29
- class ={classNames (
30
- ' pt-16 pb-4 absolute top-0 inset-x-0 z-10 bg-gradient-to-b from-100% from-secondary-900 to-transparent transition-transform' ,
31
- {
32
- ' -translate-y-12 ' : ! $topVisible
33
- }
34
- )}
35
- >
36
- <div class ={classNames (' transition-transform' , {})}>
27
+ <slot name =" header" >
28
+ <div class =" pt-8" >
37
29
<h2 class ="uppercase text-zinc-300 font-semibold tracking-wider" >{subtitle }</h2 >
38
30
<h1
39
31
class ={classNames (' text-left font-semibold tracking-wider text-stone-200 mt-1' , {
44
36
{title }
45
37
</h1 >
46
38
</div >
47
- </div >
48
- <div class =" py-48 flex-1 overflow-y-auto overflow-x-hidden scrollbar-hide" use:registerScroll >
39
+ </slot >
40
+
41
+ <slot name =" header-compact" >
42
+ <div
43
+ class ={classNames (
44
+ ' py-6 absolute top-0 inset-x-0 z-10 bg-gradient-to-b from-100% from-secondary-900 to-transparent transition-all' ,
45
+ {
46
+ ' opacity-0 pointer-events-none -translate-y-4' : $topVisible
47
+ }
48
+ )}
49
+ >
50
+ <h2 class ="uppercase text-zinc-300 font-semibold tracking-wider" >{subtitle }</h2 >
51
+ <h1
52
+ class ={classNames (' text-left font-semibold tracking-wider text-stone-200 mt-1' , {
53
+ ' text-3xl sm:text-4xl 2xl:text-5xl' : title .length || 0 < 15 ,
54
+ ' text-2xl sm:text-3xl 2xl:text-4xl' : title .length || 0 >= 15
55
+ })}
56
+ >
57
+ {title }
58
+ </h1 >
59
+ </div >
60
+ </slot >
61
+
62
+ <div class =" pt-16" use:registerScroll >
49
63
{#await items }
50
64
Loading...
51
65
{:then items }
52
- <CardGrid >
53
- {#each items as item }
54
- <TmdbCard on:enter ={scrollIntoView ({ top: 192 })} {item } />
66
+ <CardGrid let:columns
67
+ on:mount ={registrar }
68
+
69
+ >
70
+ {#each items as item , index }
71
+ <TmdbCard
72
+ on:enter ={(e ) => {
73
+ if (index < columns ) {
74
+ scrollIntoView ({ top: 500 })(e );
75
+ } else {
76
+ scrollIntoView ({ top: 192 })(e );
77
+ }
78
+ }}
79
+ {item }
80
+ />
55
81
{/each }
56
82
</CardGrid >
57
83
{/await }
Original file line number Diff line number Diff line change 7
7
import TmdbCard from ' ../components/Card/TmdbCard.svelte' ;
8
8
import CardGrid from ' ../components/CardGrid.svelte' ;
9
9
import { TMDB_POSTER_SMALL } from ' ../constants.js' ;
10
+ import CollectionPage from ' ./CollectionPages/CollectionPage.svelte' ;
10
11
import HeroTitleInfo from ' ./TitlePages/HeroTitleInfo.svelte' ;
11
12
12
13
createBackgroundPage ();
64
65
</script >
65
66
66
67
{#await person then person }
67
- <Container
68
- focusOnMount
69
- on:back ={handleGoBack }
70
- on:mount ={registrar }
71
- class =" px-32 py-16 space-y-16"
68
+ <CollectionPage
69
+ items ={titles }
70
+ subtitle =" Person"
71
+ title ={person .name ?? ' Unknown' }
72
+ {registrar }
73
+ {handleGoBack }
72
74
>
73
- <div class =" flex space-x-8" >
74
- <Container
75
- on:enter ={scrollIntoView ({ vertical: 128 })}
75
+ <div class =" flex space-x-8" slot =" header" >
76
+ <div
76
77
class =" bg-center bg-cover rounded-xl w-44 h-64 cursor-pointer flex-shrink-0"
77
78
style ={` background-image: url("${TMDB_POSTER_SMALL + person .profile_path }") ` }
78
79
/>
85
86
/>
86
87
</div >
87
88
</div >
88
-
89
- <CardGrid >
90
- {#await titles then titles }
91
- {#each titles as title }
92
- <TmdbCard item ={title } on:enter ={scrollIntoView ({ vertical: 128 })} />
93
- {/each }
94
- {/await }
95
- </CardGrid >
96
- </Container >
89
+ </CollectionPage >
97
90
{/await }
You can’t perform that action at this time.
0 commit comments