diff --git a/src/webapp/features/profile/components/profileHeader/ProfileHeader.tsx b/src/webapp/features/profile/components/profileHeader/ProfileHeader.tsx index a9e4e5a1..807e1243 100644 --- a/src/webapp/features/profile/components/profileHeader/ProfileHeader.tsx +++ b/src/webapp/features/profile/components/profileHeader/ProfileHeader.tsx @@ -8,10 +8,10 @@ import { Text, Title, Button, - ActionIcon, } from '@mantine/core'; import { FaBluesky } from 'react-icons/fa6'; import ProfileTabs from '../profileTabs/ProfileTabs'; +import { truncateText } from '@/lib/utils/text'; interface Props { handle: string; @@ -28,38 +28,38 @@ export default async function ProfileHeader(props: Props) { return ( - - - + + + - - + <Stack gap={0}> + <Title order={1} fz={'h2'}> {data.name} - - {data.handle} + + @{data.handle} - + {data.description && {data.description}} - } > - - + {truncateText(data.handle, 14)} + diff --git a/src/webapp/lib/utils/text.ts b/src/webapp/lib/utils/text.ts new file mode 100644 index 00000000..ed717ee8 --- /dev/null +++ b/src/webapp/lib/utils/text.ts @@ -0,0 +1,7 @@ +export const truncateText = (text: string, maxLength: number = 100) => { + if (typeof maxLength !== 'number' || text.length <= maxLength) { + return text; + } + + return text.slice(0, maxLength) + '...'; +};