Expand notifications by default if <= 3 items

This commit is contained in:
James Grugett 2022-08-26 00:00:44 -05:00
parent 1b029ce8dd
commit e5777f02d8

View File

@ -200,7 +200,9 @@ function IncomeNotificationGroupItem(props: {
const { notificationGroup, className } = props
const { notifications } = notificationGroup
const numSummaryLines = 3
const [expanded, setExpanded] = useState(false)
const [expanded, setExpanded] = useState(
notifications.length <= numSummaryLines
)
const [highlighted, setHighlighted] = useState(
notifications.some((n) => !n.isSeen)
)
@ -524,7 +526,7 @@ function IncomeNotificationItem(props: {
</span>
</div>
</Row>
<div className={'mt-4 border-b border-gray-300'} />
<div className={'border-b border-gray-300 pt-4'} />
</div>
</div>
)
@ -541,7 +543,9 @@ function NotificationGroupItem(props: {
const isMobile = (width && width < 768) || false
const numSummaryLines = 3
const [expanded, setExpanded] = useState(false)
const [expanded, setExpanded] = useState(
notifications.length <= numSummaryLines
)
const [highlighted, setHighlighted] = useState(
notifications.some((n) => !n.isSeen)
)