Skip to content

Commit baf85dc

Browse files
refactor: Migrate from tailwind.js config to Tailwind CSS config (#451)
* refactor: Migrate from tailwind.js config to Tailwind CSS configuration and improve component styling - Removed extensive theme and animation configurations from tailwind.config.js, migrating them to index.css for better organization. - Updated components to utilize CSS variables for grid layouts and animations, enhancing maintainability. - Adjusted various components to reflect the new CSS structure, ensuring consistent styling across the application. - Improved accessibility and responsiveness in several UI components, including headers and popovers. - Fixed minor styling issues and optimized class usage for better performance. * style: use default tailwindcss/forms options * refactor(Header): remove unused LuUser icon import
1 parent c9dd3cd commit baf85dc

22 files changed

+233
-185
lines changed

ui/src/components/AuthLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function AuthLayout({
3737
<>
3838
<GridBackground />
3939

40-
<div className="grid min-h-screen grid-rows-layout">
40+
<div className="grid min-h-screen grid-rows-(--grid-layout)">
4141
<SimpleNavbar
4242
logoHref="/"
4343
actionElement={

ui/src/components/Checkbox.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const checkboxVariants = cva({
1515
"block rounded",
1616

1717
// Colors
18-
"border-slate-300 dark:border-slate-600 bg-slate-50 dark:bg-slate-800 text-blue-700 dark:text-blue-500 transition-colors",
18+
"border-slate-300 dark:border-slate-600 bg-slate-50 dark:bg-slate-800 checked:accent-blue-700 checked:dark:accent-blue-500 transition-colors",
1919

2020
// Hover
2121
"hover:bg-slate-200/50 dark:hover:bg-slate-700/50",
@@ -41,7 +41,9 @@ const Checkbox = forwardRef<HTMLInputElement, CheckBoxProps>(function Checkbox(
4141
ref,
4242
) {
4343
const classes = checkboxVariants({ size });
44-
return <input ref={ref} {...props} type="checkbox" className={clsx(classes, className)} />;
44+
return (
45+
<input ref={ref} {...props} type="checkbox" className={clsx(classes, className)} />
46+
);
4547
});
4648
Checkbox.displayName = "Checkbox";
4749

ui/src/components/GridBackground.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export default function GridBackground() {
22
return (
3-
<div className="absolute w-screen h-screen overflow-hidden isolate opacity-60">
3+
<div className="absolute isolate h-screen w-screen overflow-hidden opacity-60">
44
<svg
5-
className="absolute inset-x-0 top-0 -z-10 h-[64rem] w-full stroke-gray-300 [mask-image:radial-gradient(center_at_32rem_32rem,white,transparent)] dark:stroke-slate-300/20"
5+
className="absolute inset-x-0 top-0 -z-10 h-full w-full mask-radial-[32rem_32rem] mask-radial-from-white mask-radial-to-transparent mask-radial-at-center stroke-gray-300 dark:stroke-slate-300/20"
66
aria-hidden="true"
77
>
88
<defs>

ui/src/components/Header.tsx

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function DashboardNavbar({
5555
//picture = "https://placehold.co/32x32"
5656

5757
return (
58-
<div className="w-full select-none border-b border-b-slate-800/20 bg-white dark:border-b-slate-300/20 dark:bg-slate-900">
58+
<div className="w-full border-b border-b-slate-800/20 bg-white select-none dark:border-b-slate-300/20 dark:bg-slate-900">
5959
<Container>
6060
<div className="flex h-14 items-center justify-between">
6161
<div className="flex shrink-0 items-center gap-x-8">
@@ -81,7 +81,7 @@ export default function DashboardNavbar({
8181
</div>
8282
<div className="flex w-full items-center justify-end gap-x-2">
8383
<div className="flex shrink-0 items-center space-x-4">
84-
<div className="hidden items-center gap-x-2 md:flex">
84+
<div className="hidden items-stretch gap-x-2 md:flex">
8585
{showConnectionStatus && (
8686
<>
8787
<div className="w-[159px]">
@@ -100,47 +100,50 @@ export default function DashboardNavbar({
100100
)}
101101
{isLoggedIn ? (
102102
<>
103-
<hr className="h-[20px] w-[1px] border-none bg-slate-800/20 dark:bg-slate-300/20" />
103+
<hr className="h-[20px] w-[1px] self-center border-none bg-slate-800/20 dark:bg-slate-300/20" />
104104
<div className="relative inline-block text-left">
105105
<Menu>
106-
<MenuButton>
107-
<Button className="flex items-center gap-x-3 rounded-md border bg-white dark:border-slate-600 dark:bg-slate-800 dark:text-white border-slate-800/20 px-2 py-1.5">
108-
{picture
109-
? (
110-
<img
111-
src={picture}
112-
alt="Avatar"
113-
className="size-6 rounded-full border-2 border-transparent transition-colors group-hover:border-blue-700"
114-
/>
115-
)
116-
: (
117-
<span className="max-w-[200px] text-sm/6 font-display font-semibold truncate">
118-
{userEmail}
119-
</span>
120-
)
121-
}
106+
<MenuButton className="h-full">
107+
<Button className="flex h-full items-center gap-x-3 rounded-md border border-slate-800/20 bg-white px-2 py-1.5 dark:border-slate-600 dark:bg-slate-800 dark:text-white">
108+
{picture ? (
109+
<img
110+
src={picture}
111+
alt="Avatar"
112+
className="size-6 rounded-full border-2 border-transparent transition-colors group-hover:border-blue-700"
113+
/>
114+
) : userEmail ? (
115+
<span className="font-display max-w-[200px] truncate text-sm/6 font-semibold">
116+
{userEmail}
117+
</span>
118+
) : null}
122119
<ChevronDownIcon className="size-4 shrink-0 text-slate-900 dark:text-white" />
123120
</Button>
124121
</MenuButton>
125122
<MenuItems
126123
transition
127124
anchor="bottom end"
128-
className="right-0 mt-1 w-56 origin-top-right data-closed:opacity-0 focus:outline-hidden">
125+
className="right-0 mt-1 w-56 origin-top-right p-px focus:outline-hidden data-closed:opacity-0"
126+
>
129127
<MenuItem>
130128
<Card className="overflow-hidden">
131-
<div className="space-y-1 p-1 dark:text-white">
132-
{userEmail && (
129+
{userEmail && (
130+
<div className="space-y-1 p-1 dark:text-white">
133131
<div className="border-b border-b-slate-800/20 dark:border-slate-300/20">
134132
<div className="p-2">
135-
<div className="font-display text-xs">Logged in as</div>
136-
<div className="max-w-[200px] truncate font-display text-sm font-semibold">
133+
<div className="font-display text-xs">
134+
Logged in as
135+
</div>
136+
<div className="font-display max-w-[200px] truncate text-sm font-semibold">
137137
{userEmail}
138138
</div>
139139
</div>
140140
</div>
141-
)}
142-
</div>
143-
<div className="space-y-1 p-1 dark:text-white" onClick={onLogout}>
141+
</div>
142+
)}
143+
<div
144+
className="space-y-1 p-1 dark:text-white"
145+
onClick={onLogout}
146+
>
144147
<button className="group flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-slate-100 dark:hover:bg-slate-700">
145148
<ArrowLeftEndOnRectangleIcon className="size-4" />
146149
<div className="font-display">Log out</div>

ui/src/components/WebRTCVideo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ export default function WebRTCVideo() {
673673
]);
674674

675675
return (
676-
<div className="grid h-full w-full grid-rows-layout">
676+
<div className="grid h-full w-full grid-rows-(--grid-layout)">
677677
<div className="flex min-h-[39.5px] flex-col">
678678
<div className="flex flex-col">
679679
<fieldset
@@ -699,7 +699,7 @@ export default function WebRTCVideo() {
699699
<div className="flex h-full flex-col">
700700
<div className="relative flex-grow overflow-hidden">
701701
<div className="flex h-full flex-col">
702-
<div className="grid flex-grow grid-rows-bodyFooter overflow-hidden">
702+
<div className="grid flex-grow grid-rows-(--grid-bodyFooter) overflow-hidden">
703703
<div className="relative mx-4 my-2 flex items-center justify-center overflow-hidden">
704704
<div className="relative flex h-full w-full items-center justify-center">
705705
<div className="relative inline-block">

ui/src/components/popovers/ExtensionPopover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default function ExtensionPopover() {
8484
return (
8585
<GridCard>
8686
<div className="space-y-4 p-4 py-3">
87-
<div className="grid h-full grid-rows-headerBody">
87+
<div className="grid h-full grid-rows-(--grid-headerBody)">
8888
<div className="space-y-4">
8989
{activeExtension ? (
9090
// Extension Control View

ui/src/components/popovers/MountPopover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ const MountPopopover = forwardRef<HTMLDivElement, object>((_props, ref) => {
194194
return (
195195
<GridCard>
196196
<div className="space-y-4 p-4 py-3">
197-
<div ref={ref} className="grid h-full grid-rows-headerBody">
197+
<div ref={ref} className="grid h-full grid-rows-(--grid-headerBody)">
198198
<div className="h-full space-y-4">
199199
<div className="space-y-4">
200200
<SettingsPageHeader

ui/src/components/popovers/PasteModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default function PasteModal() {
7474
return (
7575
<GridCard>
7676
<div className="space-y-4 p-4 py-3">
77-
<div className="grid h-full grid-rows-headerBody">
77+
<div className="grid h-full grid-rows-(--grid-headerBody)">
7878
<div className="h-full space-y-4">
7979
<div className="space-y-4">
8080
<SettingsPageHeader

ui/src/components/popovers/WakeOnLan/Index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default function WakeOnLanModal() {
102102
return (
103103
<GridCard>
104104
<div className="space-y-4 p-4 py-3">
105-
<div className="grid h-full grid-rows-headerBody">
105+
<div className="grid h-full grid-rows-(--grid-headerBody)">
106106
<div className="space-y-4">
107107
<SettingsPageHeader
108108
title="Wake On LAN"

ui/src/components/sidebar/connectionStats.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default function ConnectionStatsSidebar() {
9999
}, 500);
100100

101101
return (
102-
<div className="grid h-full grid-rows-headerBody shadow-xs">
102+
<div className="grid h-full grid-rows-(--grid-headerBody) shadow-xs">
103103
<SidebarHeader title="Connection Stats" setSidebarView={setSidebarView} />
104104
<div className="h-full space-y-4 overflow-y-scroll bg-white px-4 py-2 pb-8 dark:bg-slate-900">
105105
<div className="space-y-4">

0 commit comments

Comments
 (0)