Skip to content

Commit

Permalink
feat(home): add arrow icons to slider
Browse files Browse the repository at this point in the history
  • Loading branch information
royschut committed May 7, 2021
1 parent bb6b501 commit f04b74c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 29 deletions.
18 changes: 1 addition & 17 deletions src/components/Shelf/Shelf.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,6 @@
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;
.arrow {
cursor: pointer;
}
.arrowLeft {
left: -30px;
}
.arrowRight {
right: -30px;
}
15 changes: 8 additions & 7 deletions src/components/Shelf/Shelf.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import type { Playlist, PlaylistItem } from 'types/playlist';
import classNames from 'classnames';

import Card from '../Card/Card';
import TileDock from '../TileDock/TileDock';
import useBreakpoint, { Breakpoint } from '../../hooks/useBreakpoint';
import ArrowLeft from '../../icons/ArrowLeft';
import ArrowRight from '../../icons/ArrowRight';

import styles from './Shelf.module.scss';

Expand Down Expand Up @@ -47,14 +48,14 @@ const Shelf: React.FC<ShelfProps> = ({ playlist, onCardClick, onCardHover, featu
transitionTime="0.3s"
spacing={12}
renderLeftControl={(handleClick) => (
<button className={classNames(styles['arrowButton'], styles['arrowLeft'])} onClick={handleClick}>
&lt;
</button>
<div className={styles.arrow} onClick={handleClick}>
<ArrowLeft />
</div>
)}
renderRightControl={(handleClick) => (
<button className={classNames(styles['arrowButton'], styles['arrowRight'])} onClick={handleClick}>
&gt;
</button>
<div className={styles.arrow} onClick={handleClick}>
<ArrowRight />
</div>
)}
renderTile={(item) => {
const playlistItem = item as PlaylistItem;
Expand Down
8 changes: 4 additions & 4 deletions src/components/TileDock/TileDock.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
height: 100%;
}
.tileDock .leftControl {
left: 0px;
left: -40px;
position: absolute;
top: 50%;
top: calc(50% + 20px);
transform: translateY(-100%);
z-index: 1;
}
.tileDock .rightControl {
position: absolute;
right: 0px;
top: 50%;
right: -40px;
top: calc(50% + 20px);
transform: translateY(-100%);
}
3 changes: 2 additions & 1 deletion src/container/Shelf/Shelf.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import type { PlaylistItem } from 'types/playlist';

import usePlaylist, { UsePlaylistResult } from '../../hooks/usePlaylist';
import ShelfComponent from '../../components/Shelf/Shelf';
import type { PlaylistItem } from 'types/playlist';

type ShelfProps = {
playlistId: string;
Expand Down
10 changes: 10 additions & 0 deletions src/icons/ArrowLeft.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';

import createIcon from './Icon';

export default createIcon(
'0 0 24 24',
<g>
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />
</g>,
);
10 changes: 10 additions & 0 deletions src/icons/ArrowRight.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';

import createIcon from './Icon';

export default createIcon(
'0 0 24 24',
<g>
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" />
</g>,
);

0 comments on commit f04b74c

Please sign in to comment.