mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-10 19:40:41 +00:00
Merge pull request #1262 from Stremio/feat/improve-side-drawer-mobile-styles
Some checks are pending
Build / build (push) Waiting to run
Some checks are pending
Build / build (push) Waiting to run
This commit is contained in:
commit
0fe0fc8ca9
2 changed files with 23 additions and 4 deletions
|
|
@ -7,6 +7,11 @@
|
|||
action-buttons-container: action-buttons-container;
|
||||
}
|
||||
|
||||
:import('~stremio/components/MultiselectMenu/Dropdown/Dropdown.less') {
|
||||
dropdown: dropdown;
|
||||
open: open;
|
||||
}
|
||||
|
||||
@padding: 1rem;
|
||||
|
||||
.side-drawer {
|
||||
|
|
@ -69,6 +74,7 @@
|
|||
|
||||
.info {
|
||||
padding: @padding;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
|
||||
.side-drawer-meta-preview {
|
||||
|
|
@ -89,8 +95,11 @@
|
|||
flex: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
|
||||
.videos {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
|
@ -109,6 +118,14 @@
|
|||
@media @phone-landscape {
|
||||
.side-drawer {
|
||||
max-width: 50dvw;
|
||||
|
||||
.info {
|
||||
max-height: 40dvh;
|
||||
}
|
||||
|
||||
.dropdown.open {
|
||||
max-height: calc(3rem * 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2017-2024 Smart code 203358507
|
||||
|
||||
import React, { useMemo, useCallback, useState, forwardRef, memo } from 'react';
|
||||
import React, { useMemo, useCallback, useState, useRef, forwardRef, memo } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import Icon from '@stremio/stremio-icons/react';
|
||||
import { useCore } from 'stremio/core';
|
||||
|
|
@ -22,6 +22,7 @@ const SideDrawer = memo(forwardRef<HTMLDivElement, Props>(({ seriesInfo, classNa
|
|||
const core = useCore();
|
||||
const [season, setSeason] = useState<number>(seriesInfo?.season);
|
||||
const [selectedVideoId, setSelectedVideoId] = useState<string | null>(null);
|
||||
const videosRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const metaItem = useMemo(() => {
|
||||
return seriesInfo ?
|
||||
|
|
@ -47,8 +48,9 @@ const SideDrawer = memo(forwardRef<HTMLDivElement, Props>(({ seriesInfo, classNa
|
|||
.sort((a, b) => (a || Number.MAX_SAFE_INTEGER) - (b || Number.MAX_SAFE_INTEGER));
|
||||
}, [props.metaItem.videos]);
|
||||
|
||||
const seasonOnSelect = useCallback((event: { value: string }) => {
|
||||
setSeason(parseInt(event.value));
|
||||
const seasonOnSelect = useCallback((event: { value: string | number }) => {
|
||||
setSeason(parseInt(String(event.value), 10));
|
||||
videosRef.current?.scrollTo({ top: 0, left: 0 });
|
||||
}, []);
|
||||
|
||||
const seasonWatched = React.useMemo(() => {
|
||||
|
|
@ -109,7 +111,7 @@ const SideDrawer = memo(forwardRef<HTMLDivElement, Props>(({ seriesInfo, classNa
|
|||
seasons={seasons}
|
||||
onSelect={seasonOnSelect}
|
||||
/>
|
||||
<div className={styles['videos']}>
|
||||
<div ref={videosRef} className={styles['videos']}>
|
||||
{videos.map((video, index) => (
|
||||
<Video
|
||||
key={index}
|
||||
|
|
|
|||
Loading…
Reference in a new issue