1
1
import React , { useCallback , useEffect , useState , type CSSProperties , type TransitionEventHandler } from 'react' ;
2
- import type { PosterAspectRatio } from '@jwp/ott-common/src/utils/collection' ;
3
- import type { AccessModel } from '@jwp/ott-common/types/config' ;
4
- import type { Playlist , PlaylistItem } from '@jwp/ott-common/types/playlist' ;
2
+ import type { Playlist } from '@jwp/ott-common/types/playlist' ;
5
3
import classNames from 'classnames' ;
6
4
import { useTranslation } from 'react-i18next' ;
7
5
import ChevronLeft from '@jwp/ott-theme/assets/icons/chevron_left.svg?react' ;
@@ -11,30 +9,19 @@ import { useScrolledDown } from '../../hooks/useScrolledDown';
11
9
import Icon from '../Icon/Icon' ;
12
10
import useBreakpoint , { Breakpoint } from '../../hooks/useBreakpoint' ;
13
11
14
- import styles from './FeaturedShelf .module.scss' ;
15
- import FeaturedMetadata from './FeaturedMetadata ' ;
16
- import FeaturedBackground from './FeaturedBackground ' ;
17
- import FeaturedPagination from './FeaturedPagination ' ;
18
- import FeaturedMetadataMobile from './FeaturedMetadataMobile ' ;
12
+ import styles from './HeroShelf .module.scss' ;
13
+ import HeroShelfMetadata from './HeroShelfMetadata ' ;
14
+ import HeroShelfBackground from './HeroShelfBackground ' ;
15
+ import HeroShelfPagination from './HeroShelfPagination ' ;
16
+ import HeroShelfMetadataMobile from './HeroShelfMetadataMobile ' ;
19
17
20
18
type Props = {
21
19
playlist : Playlist ;
22
- onCardHover ?: ( playlistItem : PlaylistItem ) => void ;
23
- watchHistory ?: { [ key : string ] : number } ;
24
- enableTitle ?: boolean ;
25
- enableCardTitles ?: boolean ;
26
- featured ?: boolean ;
27
20
loading ?: boolean ;
28
21
error ?: unknown ;
29
- title ?: string ;
30
- accessModel : AccessModel ;
31
- isLoggedIn : boolean ;
32
- hasSubscription : boolean ;
33
- posterAspect ?: PosterAspectRatio ;
34
- visibleTilesDelta ?: number ;
35
22
} ;
36
23
37
- const FeaturedShelf = ( { playlist, loading = false , error = null } : Props ) => {
24
+ const HeroShelf = ( { playlist, loading = false , error = null } : Props ) => {
38
25
const [ index , setIndex ] = useState ( 0 ) ;
39
26
const [ nextIndex , setNextIndex ] = useState ( 0 ) ;
40
27
const { t } = useTranslation ( 'common' ) ;
@@ -123,14 +110,14 @@ const FeaturedShelf = ({ playlist, loading = false, error = null }: Props) => {
123
110
< div className = { classNames ( styles . shelf ) } >
124
111
< div className = { classNames ( styles . poster , styles . undimmed , { [ styles . dimmed ] : scrolledDown } ) } >
125
112
< div className = { styles . background } id = "background" >
126
- < FeaturedBackground
113
+ < HeroShelfBackground
127
114
item = { leftItem }
128
115
style = { backgroundAltStyle }
129
116
key = { renderedItem ?. mediaid === leftItem ?. mediaid ? 'left-item' : leftItem ?. mediaid }
130
117
hidden = { direction !== 'left' }
131
118
/>
132
- < FeaturedBackground item = { renderedItem } style = { backgroundCurrentStyle } key = { renderedItem ?. mediaid } onTransitionEnd = { handleBackgroundAnimationEnd } />
133
- < FeaturedBackground
119
+ < HeroShelfBackground item = { renderedItem } style = { backgroundCurrentStyle } key = { renderedItem ?. mediaid } onTransitionEnd = { handleBackgroundAnimationEnd } />
120
+ < HeroShelfBackground
134
121
item = { rightItem }
135
122
style = { backgroundAltStyle }
136
123
key = { renderedItem ?. mediaid === rightItem ?. mediaid ? 'right-item' : rightItem ?. mediaid }
@@ -149,7 +136,7 @@ const FeaturedShelf = ({ playlist, loading = false, error = null }: Props) => {
149
136
< Icon icon = { ChevronLeft } />
150
137
</ button >
151
138
{ isMobile ? (
152
- < FeaturedMetadataMobile
139
+ < HeroShelfMetadataMobile
153
140
loading = { loading }
154
141
item = { item }
155
142
rightItem = { rightItem }
@@ -161,8 +148,8 @@ const FeaturedShelf = ({ playlist, loading = false, error = null }: Props) => {
161
148
/>
162
149
) : (
163
150
< >
164
- < FeaturedMetadata item = { renderedItem } loading = { loading } playlistId = { playlist . feedid } style = { metadataCurrentStyle } />
165
- < FeaturedMetadata item = { altItem } loading = { loading } playlistId = { playlist . feedid } style = { metadataAltStyle } hidden = { ! direction } />
151
+ < HeroShelfMetadata item = { renderedItem } loading = { loading } playlistId = { playlist . feedid } style = { metadataCurrentStyle } />
152
+ < HeroShelfMetadata item = { altItem } loading = { loading } playlistId = { playlist . feedid } style = { metadataAltStyle } hidden = { ! direction } />
166
153
</ >
167
154
) }
168
155
< button
@@ -173,7 +160,7 @@ const FeaturedShelf = ({ playlist, loading = false, error = null }: Props) => {
173
160
>
174
161
< Icon icon = { ChevronRight } />
175
162
</ button >
176
- < FeaturedPagination
163
+ < HeroShelfPagination
177
164
className = { scrolledDown ? styles . dimmed : undefined }
178
165
playlist = { playlist }
179
166
index = { index }
@@ -185,4 +172,4 @@ const FeaturedShelf = ({ playlist, loading = false, error = null }: Props) => {
185
172
) ;
186
173
} ;
187
174
188
- export default FeaturedShelf ;
175
+ export default HeroShelf ;
0 commit comments