Skip to content

Commit

Permalink
fix(example): truncate long channel name (trpc#6385)
Browse files Browse the repository at this point in the history
  • Loading branch information
KATT authored Jan 11, 2025
1 parent 1b0b7d6 commit 75a84ec
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 34 deletions.
1 change: 1 addition & 0 deletions examples/next-sse-chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"react": "^19.0.0",
"react-dom": "^19.0.0",
"superjson": "^1.12.4",
"tailwind-merge": "^2.0.0",
"zod": "^3.0.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default async function Home(
)}
href={`/channels/${channel.id}`}
>
<HashtagIcon className="h-4 w-4" />
{channel.name}
<HashtagIcon className="h-4 w-4 shrink-0" />
<span className="truncate">{channel.name}</span>
</Link>
))}
</div>
Expand Down
12 changes: 8 additions & 4 deletions examples/next-sse-chat/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SignedIn, SignedOut } from '~/server/auth';
import { caller } from '~/server/routers/_app';
import Link from 'next/link';
import { Suspense } from 'react';
import { twMerge } from 'tailwind-merge';
import { CreateChannelDialog } from './channels/create-channel';

export default async function Home() {
Expand Down Expand Up @@ -58,15 +59,18 @@ export default async function Home() {
</SignedOut>
</Suspense>
</div>
<div className="flex flex-col items-start gap-2">
<div className="flex w-full flex-col items-start">
{channels.map((channel) => (
<Link
key={channel.id}
className={buttonVariants({ variant: 'link' })}
className={twMerge(
buttonVariants({ variant: 'link' }),
'w-full justify-start',
)}
href={`/channels/${channel.id}`}
>
<HashtagIcon className="mr-2 size-4" />
{channel.name}
<HashtagIcon className="mr-2 size-4 shrink-0" />
<span className="truncate">{channel.name}</span>
</Link>
))}
</div>
Expand Down
56 changes: 28 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75a84ec

Please sign in to comment.