Skip to content

Commit fccfaa1

Browse files
authored
upgrade example app to tailwind 4 (#176)
1 parent 4724cd4 commit fccfaa1

File tree

19 files changed

+418
-322
lines changed

19 files changed

+418
-322
lines changed

apps/events/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@
4141
},
4242
"devDependencies": {
4343
"@biomejs/biome": "1.9.4",
44+
"@tailwindcss/vite": "^4.1.5",
4445
"@tanstack/router-devtools": "^1.119.1",
4546
"@tanstack/router-plugin": "^1.119.0",
4647
"@types/node": "^22.15.3",
4748
"@types/react": "^19.1.2",
4849
"@types/react-dom": "^19.1.3",
4950
"@types/uuid": "^10.0.0",
5051
"@vitejs/plugin-react": "^4.4.1",
51-
"autoprefixer": "^10.4.21",
5252
"globals": "^16.0.0",
53-
"postcss": "^8.5.3",
54-
"tailwindcss": "^3.4.17",
53+
"tailwindcss": "^4.1.5",
5554
"vite-plugin-node-polyfills": "^0.23.0",
5655
"vite-plugin-top-level-await": "^1.5.0",
5756
"vite-plugin-wasm": "^3.4.1"

apps/events/postcss.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

apps/events/src/components/ui/button.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import * as React from 'react';
55
import { cn } from '@/lib/utils';
66

77
const buttonVariants = cva(
8-
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50',
8+
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50',
99
{
1010
variants: {
1111
variant: {
12-
default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',
13-
destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
14-
outline: 'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
15-
secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
12+
default: 'bg-primary text-primary-foreground shadow-sm hover:bg-primary/90',
13+
destructive: 'bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90',
14+
outline: 'border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground',
15+
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
1616
ghost: 'hover:bg-accent hover:text-accent-foreground',
1717
link: 'text-primary underline-offset-4 hover:underline',
1818
},

apps/events/src/components/ui/card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from 'react';
33
import { cn } from '@/lib/utils';
44

55
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
6-
<div ref={ref} className={cn('rounded-xl border bg-card text-card-foreground shadow', className)} {...props} />
6+
<div ref={ref} className={cn('rounded-xl border bg-card text-card-foreground shadow-sm', className)} {...props} />
77
));
88
Card.displayName = 'Card';
99

apps/events/src/components/ui/input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(({ className, type,
1010
<input
1111
type={type}
1212
className={cn(
13-
'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
13+
'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
1414
className,
1515
)}
1616
ref={ref}

apps/events/src/index.css

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,69 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@import 'tailwindcss';
2+
3+
@plugin 'tailwindcss-animate';
4+
5+
@source '../../../packages/hypergraph-react/src/**/*.{js,ts,jsx,tsx}';
6+
7+
@custom-variant dark (&:is(.dark *));
8+
9+
@theme {
10+
--radius-lg: var(--radius);
11+
--radius-md: calc(var(--radius) - 2px);
12+
--radius-sm: calc(var(--radius) - 4px);
13+
14+
--color-background: hsl(var(--background));
15+
--color-foreground: hsl(var(--foreground));
16+
17+
--color-card: hsl(var(--card));
18+
--color-card-foreground: hsl(var(--card-foreground));
19+
20+
--color-popover: hsl(var(--popover));
21+
--color-popover-foreground: hsl(var(--popover-foreground));
22+
23+
--color-primary: hsl(var(--primary));
24+
--color-primary-foreground: hsl(var(--primary-foreground));
25+
26+
--color-secondary: hsl(var(--secondary));
27+
--color-secondary-foreground: hsl(var(--secondary-foreground));
28+
29+
--color-muted: hsl(var(--muted));
30+
--color-muted-foreground: hsl(var(--muted-foreground));
31+
32+
--color-accent: hsl(var(--accent));
33+
--color-accent-foreground: hsl(var(--accent-foreground));
34+
35+
--color-destructive: hsl(var(--destructive));
36+
--color-destructive-foreground: hsl(var(--destructive-foreground));
37+
38+
--color-border: hsl(var(--border));
39+
--color-input: hsl(var(--input));
40+
--color-ring: hsl(var(--ring));
41+
42+
--color-chart-1: hsl(var(--chart-1));
43+
--color-chart-2: hsl(var(--chart-2));
44+
--color-chart-3: hsl(var(--chart-3));
45+
--color-chart-4: hsl(var(--chart-4));
46+
--color-chart-5: hsl(var(--chart-5));
47+
}
48+
49+
/*
50+
The default border color has changed to `currentcolor` in Tailwind CSS v4,
51+
so we've added these compatibility styles to make sure everything still
52+
looks the same as it did with Tailwind CSS v3.
53+
54+
If we ever want to remove these styles, we need to add an explicit border
55+
color utility to any element that depends on these defaults.
56+
*/
57+
@layer base {
58+
*,
59+
::after,
60+
::before,
61+
::backdrop,
62+
::file-selector-button {
63+
border-color: var(--color-gray-200, currentcolor);
64+
}
65+
}
66+
467
@layer base {
568
:root {
669
--background: 0 0% 100%;

apps/events/src/routes/account-inbox/$inboxId.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function RouteComponent() {
3333
<h1 className="text-2xl font-bold mb-6">Inbox Messages</h1>
3434
<div className="space-y-4">
3535
{messages.map((message) => (
36-
<div key={message.id} className="bg-card rounded-lg p-4 shadow-sm border">
36+
<div key={message.id} className="bg-card rounded-lg p-4 shadow-xs border">
3737
<div className="text-lg mb-2">{message.plaintext}</div>
3838
<div className="space-y-1 text-sm text-muted-foreground">
3939
<div className="message-time">{new Date(message.createdAt).toLocaleString()}</div>

apps/events/src/routes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function Index() {
4242
}
4343

4444
return (
45-
<div className="flex flex-col gap-4 max-w-screen-sm mx-auto py-8">
45+
<div className="flex flex-col gap-4 max-w-(--breakpoint-sm) mx-auto py-8">
4646
<h2 className="text-lg font-bold">Invitations</h2>
4747
{invitations.length === 0 && <div>No invitations</div>}
4848
<ul className="text-xs">

apps/events/src/routes/playground.lazy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const Route = createLazyFileRoute('/playground')({
1010
function RouteComponent() {
1111
return (
1212
<HypergraphSpaceProvider space="BDuZwkjCg3nPWMDshoYtpS" mapping={mapping}>
13-
<div className="flex flex-col gap-4 max-w-screen-sm mx-auto py-8">
13+
<div className="flex flex-col gap-4 max-w-(--breakpoint-sm) mx-auto py-8">
1414
<h1 className="text-2xl font-bold">Playground</h1>
1515
<Playground />
1616
</div>

apps/events/src/routes/settings/export-wallet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const Route = createFileRoute('/settings/export-wallet')({
77

88
function RouteComponent() {
99
return (
10-
<div className="flex flex-col gap-4 max-w-screen-sm mx-auto py-8">
10+
<div className="flex flex-col gap-4 max-w-(--breakpoint-sm) mx-auto py-8">
1111
<ExportWallet />
1212
</div>
1313
);

0 commit comments

Comments
 (0)