mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 15:52:02 +00:00
feature: disable season buttons
This commit is contained in:
parent
1d6a6cce44
commit
6d8ecd46c2
2 changed files with 16 additions and 2 deletions
|
|
@ -46,9 +46,18 @@ const SeasonsBar = ({ className, seasons, season, onSelect }) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [onSelect]);
|
}, [onSelect]);
|
||||||
|
|
||||||
|
const [prevDisabled, nextDisabled] = React.useMemo(() => {
|
||||||
|
const currentIndex = seasons.indexOf(season);
|
||||||
|
return [
|
||||||
|
currentIndex === 0,
|
||||||
|
currentIndex === seasons.length - 1
|
||||||
|
];
|
||||||
|
}, [season, seasons]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classnames(className, styles['seasons-bar-container'])}>
|
<div className={classnames(className, styles['seasons-bar-container'])}>
|
||||||
<Button className={styles['prev-season-button']} title={'Previous season'} data-action={'prev'} onClick={prevNextButtonOnClick}>
|
<Button className={classnames(styles['prev-season-button'], { 'disabled': prevDisabled })} title={'Previous season'} data-action={'prev'} onClick={prevNextButtonOnClick}>
|
||||||
<Icon className={styles['icon']} name={'chevron-back'} />
|
<Icon className={styles['icon']} name={'chevron-back'} />
|
||||||
<div className={styles['label']}>Prev</div>
|
<div className={styles['label']}>Prev</div>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
@ -60,7 +69,7 @@ const SeasonsBar = ({ className, seasons, season, onSelect }) => {
|
||||||
selected={selected}
|
selected={selected}
|
||||||
onSelect={seasonOnSelect}
|
onSelect={seasonOnSelect}
|
||||||
/>
|
/>
|
||||||
<Button className={styles['next-season-button']} title={'Next season'} data-action={'next'} onClick={prevNextButtonOnClick}>
|
<Button className={classnames(styles['next-season-button'], { 'disabled': nextDisabled })} title={'Next season'} data-action={'next'} onClick={prevNextButtonOnClick}>
|
||||||
<div className={styles['label']}>Next</div>
|
<div className={styles['label']}>Next</div>
|
||||||
<Icon className={styles['icon']} name={'chevron-forward'} />
|
<Icon className={styles['icon']} name={'chevron-forward'} />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,11 @@
|
||||||
border-radius: 3rem;
|
border-radius: 3rem;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover, &:focus {
|
&:hover, &:focus {
|
||||||
background-color: var(--overlay-color);
|
background-color: var(--overlay-color);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue