1
0
Fork 0

Auto-open details and hide summary button

Only show toggle comments button if there are many statuses
This commit is contained in:
Lim Chee Aun 2022-12-19 10:05:27 +08:00
parent 141f4a94dc
commit 681dfaaaff

View file

@ -175,6 +175,8 @@ function StatusPage({ id }) {
return statuses.length - limit; return statuses.length - limit;
}, [statuses.length, limit]); }, [statuses.length, limit]);
const hasManyStatuses = statuses.length > 40;
return ( return (
<div class="deck-backdrop"> <div class="deck-backdrop">
<Link href={closeLink}></Link> <Link href={closeLink}></Link>
@ -229,8 +231,8 @@ function StatusPage({ id }) {
</Link> </Link>
)} )}
{descendant && replies?.length > 0 && ( {descendant && replies?.length > 0 && (
<details class="replies"> <details class="replies" open={!hasManyStatuses}>
<summary> <summary hidden={!hasManyStatuses}>
{replies.length} repl{replies.length === 1 ? 'y' : 'ies'} {replies.length} repl{replies.length === 1 ? 'y' : 'ies'}
</summary> </summary>
<ul> <ul>