Skip to content

Commit

Permalink
feat(home): show shelf arrows on hover
Browse files Browse the repository at this point in the history
  • Loading branch information
royschut committed May 25, 2021
1 parent 8fab1dd commit f978d37
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
25 changes: 18 additions & 7 deletions src/components/Shelf/Shelf.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
margin: 12px 56px;
color: var(--primary-color);
font-family: var(--body-alt-font-family);

&:hover {
.arrow {
opacity: 1;
&.disabled {
opacity: 0.3;
}
}
}
}

.title {
Expand All @@ -32,19 +41,21 @@

.arrow {
cursor: pointer;
transition: transform 0.2s ease-out, -webkit-transform 0.2s ease-out;
transition: transform 0.2s ease-out, opacity 0.2s ease-out;
-webkit-transition: transform 0.3s ease-out, opacity 0.3s ease-out;
opacity: 0;

> svg {
width: 30px;
height: 30px;
}
&:hover {
transform: scale(1.2);
}
}
.arrowDisabled {
opacity: 0.3;
> svg {
width: 30px;
height: 30px;
&.disabled {
cursor: default;
&:hover {
transform: none;
}
}
}
6 changes: 4 additions & 2 deletions src/components/Shelf/Shelf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ const Shelf: React.FC<ShelfProps> = ({
spacing={12}
renderLeftControl={(handleClick) => (
<div
className={didSlideBefore ? styles.arrow : styles.arrowDisabled}
className={classNames(styles.arrow, {
[styles.disabled]: !didSlideBefore,
})}
role="button"
tabIndex={didSlideBefore ? 0 : -1}
aria-label="Slide left"
Expand All @@ -78,7 +80,7 @@ const Shelf: React.FC<ShelfProps> = ({
)}
renderRightControl={(handleClick) => (
<div
className={styles.arrow}
className={classNames(styles.arrow)}
role="button"
tabIndex={0}
aria-label="Slide right"
Expand Down

0 comments on commit f978d37

Please sign in to comment.