-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
487 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,40 @@ | ||
import React from 'react'; | ||
import React, { memo } from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
import { formatDurationTag } from '../../utils/formatting'; | ||
|
||
import styles from './Card.module.scss'; | ||
|
||
type CardProps = { | ||
onClick: (() => void); | ||
onClick: () => void; | ||
onHover: () => void; | ||
title: string; | ||
duration: number; | ||
posterSource?: string; | ||
posterAspect?: "1:1" | "2:1" | "2:3" | "4:3" | "5:3" | "16:9" | "9:16"; | ||
posterAspect?: '1:1' | '2:1' | '2:3' | '4:3' | '5:3' | '16:9' | '9:16'; | ||
featured: boolean; | ||
}; | ||
|
||
function Card({ | ||
onClick, | ||
onHover, | ||
title, | ||
duration, | ||
posterSource, | ||
posterAspect = "16:9", | ||
posterAspect = '16:9', | ||
featured = false, | ||
}: CardProps): JSX.Element { | ||
const posterClassNames = classNames(styles.poster, styles[`aspect${posterAspect.replace(':', '')}`]) | ||
const posterClassNames = classNames(styles.poster, styles[`aspect${posterAspect.replace(':', '')}`]); | ||
|
||
return ( | ||
<div className={styles.card} onClick={onClick} role="button" aria-label={`Play ${title}`}> | ||
<div | ||
className={posterClassNames} | ||
style={{ backgroundImage: `url(${posterSource})` }} | ||
> | ||
<div className={styles.card} onClick={onClick} onMouseEnter={onHover} role="button" aria-label={`Play ${title}`}> | ||
<div className={posterClassNames} style={{ backgroundImage: `url(${posterSource})` }}> | ||
{duration && <div className={styles.tag}>{formatDurationTag(duration)}</div>} | ||
{featured && <div className={styles.titleFeatured}>{title}</div>} | ||
</div> | ||
<p className={styles.title}>{title}</p> | ||
{!featured && <p className={styles.title}>{title}</p>} | ||
</div> | ||
); | ||
} | ||
|
||
export default Card; | ||
export default memo(Card); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,36 @@ | ||
@use '../../styles/variables'; | ||
@use '../../styles/theme'; | ||
|
||
.Shelf { | ||
margin: 0px 56px; | ||
} | ||
|
||
.title { | ||
overflow: hidden; | ||
font-family: var(--body-font-family); | ||
color: var(--card-color); | ||
font-weight: 700; | ||
width: 100%; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
.arrowButton { | ||
position: absolute; | ||
background: none; | ||
color: white; | ||
border: none; | ||
font-size: 2em; | ||
font-weight: 400; | ||
font-variant: normal; | ||
line-height: 1; | ||
-webkit-font-smoothing: antialiased; | ||
z-index: 1; | ||
cursor: pointer; | ||
} | ||
.arrowLeft { | ||
left: -30px; | ||
} | ||
.arrowRight { | ||
right: -30px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import Shelf from './Shelf'; | ||
// import React from 'react'; | ||
// import { render, screen } from '@testing-library/react'; | ||
// import Shelf from './Shelf'; | ||
|
||
describe('FeaturedShelf Component tests', () => { | ||
test.skip('dummy test', () => { | ||
render(<Shelf title="test" playlist={[]} featured></Shelf>); | ||
expect(screen.getByText('hello world')).toBeInTheDocument(); | ||
// render(<Shelf title="test" playlist={[]} featured></Shelf>); | ||
// expect(screen.getByText('hello world')).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.tileDock { | ||
overflow: hidden; | ||
position: relative; | ||
} | ||
.tileDock ul { | ||
|
Oops, something went wrong.