From 9bd0ea22f5ef5a7824f454ad56eea768494a24e7 Mon Sep 17 00:00:00 2001 From: danidfra Date: Tue, 10 Sep 2024 21:41:16 -0300 Subject: [PATCH] Create display-name-row --- src/components/display-name-row.tsx | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/components/display-name-row.tsx diff --git a/src/components/display-name-row.tsx b/src/components/display-name-row.tsx new file mode 100644 index 000000000..ac617ff0a --- /dev/null +++ b/src/components/display-name-row.tsx @@ -0,0 +1,45 @@ +import React from 'react'; + +import { useSoapboxConfig } from 'soapbox/hooks'; + +import { getAcct } from '../utils/accounts'; + +import { HStack, Text } from './ui'; +import VerificationBadge from './verification-badge'; + +import type { Account } from 'soapbox/schemas'; + +interface IDisplayName { + account: Pick; + withSuffix?: boolean; +} + +const DisplayNameRow: React.FC = ({ account, withSuffix = true }) => { + const { displayFqn = false } = useSoapboxConfig(); + const { verified } = account; + + const displayName = ( + + + + {verified && } + + ); + + const suffix = (@{getAcct(account, displayFqn)}); + + return ( +
+ {displayName} + - + {withSuffix && suffix} +
+ ); +}; + +export default DisplayNameRow;