diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2026-09-08 11:31:46 -0400 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2026-09-08 11:31:46 -0400 |
| commit | b3749ecc4b094a46d2ab9f638ee810f70840f67a (patch) | |
| tree | 5c0fd5571f28c3791b3454b2ba7111b6653151d3 /src/components/ProfileDetails.tsx | |
| parent | c6c24524b46e237bee796cb57b9a27c437c458ae (diff) | |
| download | decky-lsfg-vk-b3749ecc4b094a46d2ab9f638ee810f70840f67a.tar.gz decky-lsfg-vk-b3749ecc4b094a46d2ab9f638ee810f70840f67a.zip | |
update layout and config and hash
Diffstat (limited to 'src/components/ProfileDetails.tsx')
| -rw-r--r-- | src/components/ProfileDetails.tsx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/components/ProfileDetails.tsx b/src/components/ProfileDetails.tsx new file mode 100644 index 0000000..056abbb --- /dev/null +++ b/src/components/ProfileDetails.tsx @@ -0,0 +1,37 @@ +import { ButtonItem, Field, Focusable, PanelSectionRow } from "@decky/ui"; +import { useEffect, useRef, useState } from "react"; +import { RiArrowDownSFill, RiArrowUpSFill } from "react-icons/ri"; + +interface ProfileDetailsProps { + description: string; +} + +export function ProfileDetails({ description }: ProfileDetailsProps) { + const [expanded, setExpanded] = useState(false); + const detailsRef = useRef<HTMLDivElement>(null); + + useEffect(() => { + if (!expanded) return; + const frame = requestAnimationFrame(() => detailsRef.current?.scrollIntoView({ block: "nearest" })); + return () => cancelAnimationFrame(frame); + }, [expanded]); + + return ( + <Focusable ref={detailsRef} noFocusRing> + <PanelSectionRow> + <ButtonItem + layout="below" + bottomSeparator={expanded ? "none" : "standard"} + onClick={() => setExpanded((value) => !value)} + > + {expanded ? <RiArrowUpSFill /> : <RiArrowDownSFill />} Details + </ButtonItem> + </PanelSectionRow> + {expanded && ( + <PanelSectionRow> + <Field label="Details" description={description} /> + </PanelSectionRow> + )} + </Focusable> + ); +} |
