Skip to content

Commit fb917dc

Browse files
authored
upgrade to tailwind v4 and some minor tweaks (#968)
* upgrade to tailwind v4 and some minor tweaks * added optional size prop and made variant prop optional of status button * set the config to "" as tailwind config no longer exist in tailwind v4 and fixed the colors
1 parent dd44318 commit fb917dc

33 files changed

+1207
-1256
lines changed

app/components/floating-toolbar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export const floatingToolbarClassName =
2-
'absolute bottom-3 left-3 right-3 flex items-center gap-2 rounded-lg bg-muted/80 p-4 pl-5 shadow-xl shadow-accent backdrop-blur-sm md:gap-4 md:pl-7 justify-end'
2+
'absolute bottom-3 inset-x-3 flex items-center gap-2 rounded-lg bg-muted/80 p-4 pl-5 shadow-xl shadow-accent backdrop-blur-xs md:gap-4 md:pl-7 justify-end'

app/components/progress-bar.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ function EpicProgress() {
3232
role="progressbar"
3333
aria-hidden={delayedPending ? undefined : true}
3434
aria-valuetext={delayedPending ? 'Loading' : undefined}
35-
className="fixed inset-x-0 left-0 top-0 z-50 h-[0.20rem] animate-pulse"
35+
className="fixed inset-x-0 top-0 z-50 h-[0.20rem] animate-pulse"
3636
>
3737
<div
3838
ref={ref}
3939
className={cn(
40-
'h-full w-0 bg-foreground duration-500 ease-in-out',
40+
'bg-foreground h-full w-0 duration-500 ease-in-out',
4141
transition.state === 'idle' &&
4242
(animationComplete
4343
? 'transition-none'
@@ -51,7 +51,7 @@ function EpicProgress() {
5151
<Icon
5252
name="update"
5353
size="md"
54-
className="m-1 animate-spin text-foreground"
54+
className="text-foreground m-1 animate-spin"
5555
aria-hidden
5656
/>
5757
</div>

app/components/ui/button.tsx

+23-21
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import * as React from 'react'
55
import { cn } from '#app/utils/misc.tsx'
66

77
const buttonVariants = cva(
8-
'inline-flex items-center justify-center rounded-md text-sm font-medium outline-none ring-ring ring-offset-2 ring-offset-background transition-colors focus-within:ring-2 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50',
8+
'ring-ring ring-offset-background inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-2 outline-hidden transition-colors focus-within:ring-2 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50',
99
{
1010
variants: {
1111
variant: {
1212
default: 'bg-primary text-primary-foreground hover:bg-primary/80',
1313
destructive:
1414
'bg-destructive text-destructive-foreground hover:bg-destructive/80',
1515
outline:
16-
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
16+
'border-input bg-background hover:bg-accent hover:text-accent-foreground border',
1717
secondary:
1818
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
1919
ghost: 'hover:bg-accent hover:text-accent-foreground',
@@ -25,7 +25,7 @@ const buttonVariants = cva(
2525
sm: 'h-9 rounded-md px-3',
2626
lg: 'h-11 rounded-md px-8',
2727
pill: 'px-12 py-3 leading-3',
28-
icon: 'h-10 w-10',
28+
icon: 'size-10',
2929
},
3030
},
3131
defaultVariants: {
@@ -35,24 +35,26 @@ const buttonVariants = cva(
3535
},
3636
)
3737

38-
export interface ButtonProps
39-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
40-
VariantProps<typeof buttonVariants> {
41-
asChild?: boolean
42-
}
38+
export type ButtonVariant = VariantProps<typeof buttonVariants>
4339

44-
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
45-
({ className, variant, size, asChild = false, ...props }, ref) => {
46-
const Comp = asChild ? Slot : 'button'
47-
return (
48-
<Comp
49-
className={cn(buttonVariants({ variant, size, className }))}
50-
ref={ref}
51-
{...props}
52-
/>
53-
)
54-
},
55-
)
56-
Button.displayName = 'Button'
40+
const Button = ({
41+
className,
42+
variant,
43+
size,
44+
asChild = false,
45+
...props
46+
}: React.ComponentProps<'button'> &
47+
ButtonVariant & {
48+
asChild?: boolean
49+
}) => {
50+
const Comp = asChild ? Slot : 'button'
51+
return (
52+
<Comp
53+
data-slot="button"
54+
className={cn(buttonVariants({ variant, size, className }))}
55+
{...props}
56+
/>
57+
)
58+
}
5759

5860
export { Button, buttonVariants }

app/components/ui/checkbox.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@ export type CheckboxProps = Omit<
1010
type?: string
1111
}
1212

13-
const Checkbox = React.forwardRef<
14-
React.ElementRef<typeof CheckboxPrimitive.Root>,
15-
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
16-
>(({ className, ...props }, ref) => (
13+
const Checkbox = ({
14+
className,
15+
...props
16+
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) => (
1717
<CheckboxPrimitive.Root
18-
ref={ref}
18+
data-slot="checkbox"
1919
className={cn(
20-
'peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
20+
'peer border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground size-4 shrink-0 rounded-sm border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
2121
className,
2222
)}
2323
{...props}
2424
>
2525
<CheckboxPrimitive.Indicator
26+
data-slot="checkbox-indicator"
2627
className={cn('flex items-center justify-center text-current')}
2728
>
2829
<svg viewBox="0 0 8 8">
@@ -35,7 +36,6 @@ const Checkbox = React.forwardRef<
3536
</svg>
3637
</CheckboxPrimitive.Indicator>
3738
</CheckboxPrimitive.Root>
38-
))
39-
Checkbox.displayName = CheckboxPrimitive.Root.displayName
39+
)
4040

4141
export { Checkbox }

0 commit comments

Comments
 (0)