Skip to content

Commit ce428f0

Browse files
authored
Merge pull request #101 from filecoin-project/bp/fix-responsiveness
[UXIT-3605] Fix responsiveness issues on upload cards
2 parents 15af919 + 4f8fb71 commit ce428f0

File tree

9 files changed

+54
-31
lines changed

9 files changed

+54
-31
lines changed

src/components/file-picker/dashed-container.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function DashedContainer({ className, ...rest }: DashedContainerProps) {
99
{...rest}
1010
className={clsx(
1111
className,
12-
'flex h-full w-full items-center justify-center rounded-lg border border-dashed border-zinc-700 bg-zinc-950'
12+
'flex h-full w-full items-center justify-center rounded-lg border border-dashed border-zinc-700 bg-zinc-950 p-6'
1313
)}
1414
/>
1515
)

src/components/file-picker/selected-file.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ type SelectedFileProps = {
1111
export function SelectedFile({ file, onReset }: SelectedFileProps) {
1212
return (
1313
<DashedContainer>
14-
<div className="flex items-center gap-1">
15-
<p className="font-medium text-zinc-50">{file.name}</p>
14+
<div className="flex items-center gap-1 min-w-0">
15+
<p className="font-medium text-zinc-50 break-words min-w-0">{file.name}</p>
1616
<button
1717
className="group/button cursor-pointer rounded-full p-2 focus:outline-none"
1818
onClick={onReset}

src/components/ui/badge-status.tsx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,24 @@ type BadgeStatusProps = VariantProps<typeof badgeVariants> & {
99
status: Status
1010
}
1111

12-
const badgeVariants = cva('inline-flex items-center gap-1 pl-1.5 pr-2 py-0.5 rounded-full text-sm font-medium', {
13-
variants: {
14-
status: {
15-
'in-progress': 'bg-badge-in-progress text-badge-in-progress-text border border-badge-in-progress-border',
16-
completed: 'bg-brand-950 text-brand-700 border border-brand-900',
17-
pinned: 'bg-brand-950 text-brand-700 border border-brand-900',
18-
published: 'bg-yellow-600/30 border border-yellow-400/20 text-yellow-200',
19-
error: null,
20-
pending: 'bg-zinc-800 border border-zinc-700 text-zinc-300',
12+
const badgeVariants = cva(
13+
'inline-flex items-center gap-1 pl-1.5 pr-2 py-0.5 rounded-full text-sm font-medium flex-shrink-0',
14+
{
15+
variants: {
16+
status: {
17+
'in-progress': 'bg-badge-in-progress text-badge-in-progress-text border border-badge-in-progress-border',
18+
completed: 'bg-brand-950 text-brand-700 border border-brand-900',
19+
pinned: 'bg-brand-950 text-brand-700 border border-brand-900',
20+
published: 'bg-yellow-600/30 border border-yellow-400/20 text-yellow-200',
21+
error: null,
22+
pending: 'bg-zinc-800 border border-zinc-700 text-zinc-300',
23+
},
2124
},
22-
},
23-
defaultVariants: {
24-
status: 'in-progress',
25-
},
26-
})
25+
defaultVariants: {
26+
status: 'in-progress',
27+
},
28+
}
29+
)
2730

2831
const statusIcons: Record<Status, React.ReactNode> = {
2932
'in-progress': <LoaderCircle className="animate-spin" size={12} />,

src/components/ui/card.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function CardHeader({ title, status, estimatedTime, withSpinner }: CardHeaderPro
3333
const showSpinner = isInProgress && withSpinner
3434

3535
return (
36-
<div className="flex items-center justify-between">
36+
<div className="flex items-center justify-between gap-2">
3737
<div className="flex items-center gap-3">
3838
{showSpinner && <Spinner size="sm" />}
3939
<Heading tag="h4">{title}</Heading>
@@ -56,8 +56,8 @@ function CardContent({ children }: CardContentProps) {
5656

5757
function CardInfoRow({ title, subtitle, children }: CardInfoRowProps) {
5858
return (
59-
<div className="flex items-center justify-between">
60-
<div className="flex flex-col gap-2 text-base">
59+
<div className="flex items-center justify-between gap-6">
60+
<div className="flex flex-col gap-2 text-base min-w-0 flex-1">
6161
<Heading tag="h4">{title}</Heading>
6262
<p>{subtitle}</p>
6363
</div>

src/components/ui/file-info.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ type FileInfoProps = {
1010

1111
function FileInfo({ fileName, fileSize, badgeStatus, children }: FileInfoProps) {
1212
return (
13-
<div className="flex justify-between items-center">
14-
<div className="flex flex-col gap-1">
15-
<Heading tag="h3">{fileName}</Heading>
13+
<div className="flex justify-between items-center gap-6">
14+
<div className="flex flex-col gap-1 min-w-0 flex-1">
15+
<Heading tag="h3">
16+
<span className="break-words min-w-0" title={fileName}>
17+
{fileName}
18+
</span>
19+
</Heading>
1620
<p className="text-zinc-400">{fileSize}</p>
1721
</div>
18-
<div className="flex items-center gap-6">
22+
<div className="flex items-center gap-3 flex-shrink-0">
1923
<BadgeStatus status={badgeStatus} />
2024
{children}
2125
</div>

src/components/ui/heading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { cn } from '../../utils/cn.ts'
33

44
export type HeadingProps = VariantProps<typeof headingVariants> & {
55
tag: 'h1' | 'h2' | 'h3' | 'h4'
6-
children: string
6+
children: string | React.ReactNode
77
}
88

99
const headingVariants = cva('text-balance', {

src/components/ui/link.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
import { cn } from '@/utils/cn.ts'
2+
13
type TextLinkProps = {
24
href: string
35
children: React.ReactNode
6+
isTruncated?: boolean
47
}
58

6-
function TextLink(props: TextLinkProps) {
7-
return <ExternalLink {...props} className="text-brand-500 underline focus:brand-outline hover:text-brand-100" />
9+
function TextLink({ href, children, isTruncated }: TextLinkProps) {
10+
return (
11+
<ExternalLink
12+
className={cn('text-brand-500 underline focus:brand-outline hover:text-brand-100', isTruncated && 'truncate')}
13+
href={href}
14+
>
15+
{children}
16+
</ExternalLink>
17+
)
818
}
919

1020
type ExternalLinkProps = Omit<React.ComponentProps<'a'>, 'rel' | 'target'>

src/components/ui/spinner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function Spinner({ className, size = 'md', ...props }: SpinnerProps) {
2323
role="status"
2424
size={sizeValue}
2525
{...props}
26-
className={cn('text-brand-700 animate-spin', className)}
26+
className={cn('text-brand-700 animate-spin flex-shrink-0', className)}
2727
/>
2828
)
2929
}

src/components/ui/text-with-copy-to-clipboard.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ function TextWithCopyToClipboard({ text, href }: TextWithCopyToClipboardProps) {
1919
}
2020

2121
return (
22-
<span className="flex items-center gap-2">
23-
{href ? <TextLink href={href}>{text}</TextLink> : <span className="text-zinc-400">{text}</span>}
22+
<span className="flex items-center gap-2 min-w-0 w-full">
23+
{href ? (
24+
<TextLink href={href} isTruncated>
25+
{text}
26+
</TextLink>
27+
) : (
28+
<span className="text-zinc-400">{text}</span>
29+
)}
2430
<button
25-
className="cursor-pointer text-zinc-400 p-2 -m-2 hover:text-white focus:brand-outline border border-transparent rounded-md "
31+
className="cursor-pointer text-zinc-400 p-2 -m-2 hover:text-white focus:brand-outline border border-transparent rounded-md flex-shrink-0"
2632
onClick={handleCopyToClipboard}
2733
title="Copy to clipboard"
2834
type="button"

0 commit comments

Comments
 (0)