Fix home page for small screens

This commit is contained in:
Zoe Roux 2023-10-22 00:08:18 +02:00
parent 7698a1490e
commit aceb6ee14c
5 changed files with 38 additions and 26 deletions

View File

@ -361,15 +361,7 @@ export const Header = ({
src={data?.thumbnail} src={data?.thumbnail}
quality="high" quality="high"
alt="" alt=""
containerStyle={{ containerStyle={Header.containerStyle}
height: {
xs: vh(40),
sm: min(vh(60), px(750)),
md: min(vh(60), px(680)),
lg: vh(70),
},
minHeight: { xs: px(350), sm: px(300), md: px(400), lg: px(600) },
}}
> >
<TitleLine <TitleLine
isLoading={isLoading} isLoading={isLoading}
@ -381,14 +373,7 @@ export const Header = ({
poster={data?.poster} poster={data?.poster}
trailerUrl={data?.trailer} trailerUrl={data?.trailer}
studio={data?.studio} studio={data?.studio}
{...css({ {...css(Header.childStyle)}
marginTop: {
xs: max(vh(20), px(200)),
sm: vh(45),
md: max(vh(30), px(150)),
lg: max(vh(35), px(200)),
},
})}
/> />
</ImageBackground> </ImageBackground>
<Description <Description
@ -403,3 +388,22 @@ export const Header = ({
</Fetch> </Fetch>
); );
}; };
Header.containerStyle = {
height: {
xs: vh(40),
sm: min(vh(60), px(750)),
md: min(vh(60), px(680)),
lg: vh(70),
},
minHeight: { xs: px(350), sm: px(300), md: px(400), lg: px(600) },
};
Header.childStyle = {
marginTop: {
xs: max(vh(20), px(200)),
sm: vh(45),
md: max(vh(30), px(150)),
lg: max(vh(35), px(200)),
},
};

View File

@ -48,7 +48,7 @@ export const MovieDetails: QueryPage<{ slug: string }> = ({ slug }) => {
}, },
)} )}
> >
<Header slug={slug} type="movie" query={query(slug)} /> <Header type="movie" query={query(slug)} />
{/* <Staff slug={slug} /> */} {/* <Staff slug={slug} /> */}
</ScrollView> </ScrollView>
); );

View File

@ -104,7 +104,7 @@ export const EpisodeList = <Props,>({
}: { }: {
slug: string; slug: string;
season: string | number; season: string | number;
Header: ComponentType<Props & { children: JSX.Element }>; Header: ComponentType<Props & { children: JSX.Element; empty: boolean }>;
headerProps: Props; headerProps: Props;
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@ -31,8 +31,9 @@ import {
ts, ts,
} from "@kyoo/primitives"; } from "@kyoo/primitives";
import { View } from "react-native"; import { View } from "react-native";
import { percent, useYoshiki, vh } from "yoshiki/native"; import { percent, useYoshiki } from "yoshiki/native";
import { WithLoading } from "../fetch"; import { WithLoading } from "../fetch";
import { Header as DetailsHeader } from "../details/header";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import PlayArrow from "@material-symbols/svg-400/rounded/play_arrow-fill.svg"; import PlayArrow from "@material-symbols/svg-400/rounded/play_arrow-fill.svg";
import Info from "@material-symbols/svg-400/rounded/info.svg"; import Info from "@material-symbols/svg-400/rounded/info.svg";
@ -58,8 +59,15 @@ export const Header = ({
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<ImageBackground src={thumbnail} alt="" quality="high" {...css({ height: vh(70) }, props)}> <ImageBackground
<View {...css({ width: percent(70), position: "absolute", bottom: 0, margin: ts(2) })}> src={thumbnail}
alt=""
quality="high"
{...css(DetailsHeader.containerStyle, props)}
>
<View
{...css({ width: { md: percent(70) }, position: "absolute", bottom: 0, margin: ts(2) })}
>
<H1>{name}</H1> <H1>{name}</H1>
<View {...css({ flexDirection: "row" })}> <View {...css({ flexDirection: "row" })}>
<IconFab <IconFab
@ -77,7 +85,7 @@ export const Header = ({
/> />
<H2>{tagline}</H2> <H2>{tagline}</H2>
</View> </View>
<P>{overview}</P> <P {...css({ display: { xs: "none", md: "flex" } })}>{overview}</P>
</View> </View>
</ImageBackground> </ImageBackground>
); );

View File

@ -133,9 +133,9 @@ export const ItemDetails = ({
minHeight: px(50), minHeight: px(50),
})} })}
> >
<View {...css({ flexDirection: "row" })}> <ScrollView horizontal>
{genres?.slice(0, 2).map((x) => <Chip key={x} label={x} {...css({ mX: ts(0.5) })} />)} {genres?.map((x) => <Chip key={x} label={x} {...css({ mX: ts(0.5) })} />)}
</View> </ScrollView>
<IconFab <IconFab
icon={PlayArrow} icon={PlayArrow}
size={20} size={20}