Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 31x 31x | // A tenancy's deposit on the Tenancy page (openspec: deposits, "The deposit
// on the tenancy page"): the amount and when it is returned, or that there
// is none. Owners get the link to the correction form from the route.
import Stack from '@mui/material/Stack'
import Typography from '@mui/material/Typography'
import type { ReactNode } from 'react'
import { formatMoney } from '#/lib/format'
import { m } from '#/paraglide/messages.js'
import { colors, radii } from '#/theme/tokens'
interface Props {
/** Cents; null or 0 when no deposit is set. */
deposit: number | null | undefined
/** Owners only: Change, or Add when no deposit is set. */
action?: ReactNode
}
export function DepositCard(props: Props) {
const set = props.deposit != null && props.deposit > 0
return (
<Stack
component="section"
aria-labelledby="deposit-title"
sx={{
bgcolor: 'background.paper',
border: `1px solid ${colors.cardBorder}`,
borderRadius: `${String(radii.card)}px`,
gap: 0.75,
px: 2,
py: 1.75,
}}
>
<Stack direction="row" sx={{ alignItems: 'center', gap: 1.5 }}>
<Typography
id="deposit-title"
component="h2"
sx={{ flex: 1, fontSize: 15, fontWeight: 900 }}
>
{m.deposit_card_title()}
</Typography>
{props.action}
</Stack>
{set ? (
<>
<Typography sx={{ fontSize: 18, fontWeight: 900 }}>
{formatMoney(props.deposit ?? 0)}
</Typography>
<Typography variant="body2" color="text.secondary">
{m.deposit_card_text()}
</Typography>
</>
) : (
<Typography variant="body2" color="text.secondary">
{m.deposit_card_none()}
</Typography>
)}
</Stack>
)
}
|