mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-07 00:34:41 +00:00
feat: add description collapsing for mobile on release page
This commit is contained in:
parent
31c083030d
commit
98bb7f3dce
1 changed files with 23 additions and 2 deletions
|
@ -1,10 +1,14 @@
|
||||||
import { Card } from "flowbite-react";
|
import { Card, Button } from "flowbite-react";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
export const ReleaseInfoBasics = (props: {
|
export const ReleaseInfoBasics = (props: {
|
||||||
image: string;
|
image: string;
|
||||||
title: { ru: string; original: string };
|
title: { ru: string; original: string };
|
||||||
note: string | null;
|
note: string | null;
|
||||||
description: string;
|
description: string;
|
||||||
}) => {
|
}) => {
|
||||||
|
const [isFullDescription, setIsFullDescription] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="h-full">
|
<Card className="h-full">
|
||||||
<div className="flex flex-col w-full h-full gap-4 lg:flex-row">
|
<div className="flex flex-col w-full h-full gap-4 lg:flex-row">
|
||||||
|
@ -27,7 +31,24 @@ export const ReleaseInfoBasics = (props: {
|
||||||
<div id="note" className="ml-2"></div>
|
<div id="note" className="ml-2"></div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<p>{props.description}</p>
|
<p
|
||||||
|
className={`overflow-y-hidden transition-[max-height] max-h-[var(--max-height)] md:max-h-full`}
|
||||||
|
style={
|
||||||
|
{
|
||||||
|
"--max-height": isFullDescription ? "1000px" : "80px",
|
||||||
|
} as React.CSSProperties
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{props.description}
|
||||||
|
</p>
|
||||||
|
<Button
|
||||||
|
onClick={() => setIsFullDescription(!isFullDescription)}
|
||||||
|
color="light"
|
||||||
|
size={"sm"}
|
||||||
|
className={`md:hidden block}`}
|
||||||
|
>
|
||||||
|
{isFullDescription ? "Скрыть" : "Показать полностью"}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
Loading…
Add table
Reference in a new issue