Truncate group name in panels

This commit is contained in:
Chewbacca 2023-05-23 12:32:55 -04:00
parent 5c069b8b93
commit c8ff9db879
4 changed files with 10 additions and 7 deletions

View File

@ -22,17 +22,18 @@ const GroupListItem = (props: IGroup) => {
justifyContent='between'
data-testid='group-list-item'
>
<Link key={group.id} to={`/group/${group.slug}`}>
<Link key={group.id} to={`/group/${group.slug}`} className='overflow-hidden'>
<HStack alignItems='center' space={2}>
<GroupAvatar
group={group}
size={44}
/>
<Stack>
<Stack className='overflow-hidden'>
<Text
weight='bold'
dangerouslySetInnerHTML={{ __html: group.display_name_html }}
truncate
/>
<HStack className='text-gray-700 dark:text-gray-600' space={1} alignItems='center'>

View File

@ -4,7 +4,7 @@ import { HStack, Stack, Text } from 'soapbox/components/ui';
import { generateText, randomIntFromInterval } from '../utils';
export default () => {
export default ({ withJoinAction = true }: { withJoinAction?: boolean }) => {
const groupNameLength = randomIntFromInterval(12, 20);
return (
@ -13,7 +13,7 @@ export default () => {
justifyContent='between'
className='animate-pulse'
>
<HStack alignItems='center' space={2}>
<HStack alignItems='center' space={2} className='overflow-hidden'>
{/* Group Avatar */}
<div className='h-11 w-11 rounded-full bg-gray-500 dark:bg-gray-700 dark:ring-primary-900' />
@ -37,7 +37,9 @@ export default () => {
</HStack>
{/* Join Group Button */}
<div className='h-10 w-36 rounded-full bg-gray-300 dark:bg-gray-800' />
{withJoinAction && (
<div className='h-10 w-36 rounded-full bg-gray-300 dark:bg-gray-800' />
)}
</HStack>
);
};

View File

@ -19,7 +19,7 @@ const MyGroupsPanel = () => {
>
{isFetching ? (
new Array(3).fill(0).map((_, idx) => (
<PlaceholderGroupSearch key={idx} />
<PlaceholderGroupSearch key={idx} withJoinAction={false} />
))
) : (
groups.slice(0, 3).map((group) => (

View File

@ -19,7 +19,7 @@ const SuggestedGroupsPanel = () => {
>
{isFetching ? (
new Array(3).fill(0).map((_, idx) => (
<PlaceholderGroupSearch key={idx} />
<PlaceholderGroupSearch key={idx} withJoinAction={false} />
))
) : (
groups.slice(0, 3).map((group) => (