Skip to content

Commit 8d1b779

Browse files
committed
make examples more fancy
1 parent 9a25cd1 commit 8d1b779

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

apps/example/app/custom/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ export default async function CustomExample() {
1919
<div className="flex flex-wrap gap-1 pb-2">
2020
<ThemeButton
2121
theme="light"
22+
bg="bg-geist-background"
2223
className="border-geist-accents-2 hover:border-geist-accents-3 bg-geist-accents-1 hover:bg-geist-accents-2 active:bg-geist-accents-3"
2324
/>
2425
<ThemeButton
2526
theme="dark"
27+
bg="bg-geist-background"
2628
className="border-geist-accents-2 hover:border-geist-accents-3 bg-geist-accents-1 hover:bg-geist-accents-2 active:bg-geist-accents-3"
2729
/>
2830
</div>

apps/example/app/radix-colors/page.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ export default async function CustomExample() {
1919
<div className="flex flex-wrap gap-1 pb-2">
2020
<ThemeButton
2121
theme="gray-light"
22+
bg="bg-primary-1"
2223
className="border-primary-7 hover:border-primary-8 bg-primary-3 hover:bg-primary-4 active:bg-primary-5"
2324
/>
2425
<ThemeButton
2526
theme="gray-dark"
27+
bg="bg-primary-1"
2628
className="border-primary-7 hover:border-primary-8 bg-primary-3 hover:bg-primary-4 active:bg-primary-5"
2729
/>
2830
<ThemeButton
2931
theme="amber-light"
32+
bg="bg-primary-1"
3033
className="border-primary-7 hover:border-primary-8 bg-primary-3 hover:bg-primary-4 active:bg-primary-5"
3134
/>
3235
<ThemeButton
3336
theme="amber-dark"
37+
bg="bg-primary-1"
3438
className="border-primary-7 hover:border-primary-8 bg-primary-3 hover:bg-primary-4 active:bg-primary-5"
3539
/>
3640
</div>

apps/example/app/tailwind-colors/page.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ export default async function CustomExample() {
1919
<div className="flex flex-wrap gap-1 pb-2">
2020
<ThemeButton
2121
theme="gray-light"
22+
bg="bg-primary-100"
2223
className="border-primary-300 hover:border-primary-400 bg-primary-100 hover:bg-primary-200 active:bg-primary-300"
2324
/>
2425
<ThemeButton
2526
theme="gray-dark"
27+
bg="bg-primary-100"
2628
className="border-primary-300 hover:border-primary-400 bg-primary-100 hover:bg-primary-200 active:bg-primary-300"
2729
/>
2830
<ThemeButton
2931
theme="amber-light"
32+
bg="bg-primary-100"
3033
className="border-primary-300 hover:border-primary-400 bg-primary-100 hover:bg-primary-200 active:bg-primary-300"
3134
/>
3235
<ThemeButton
3336
theme="amber-dark"
37+
bg="bg-primary-100"
3438
className="border-primary-300 hover:border-primary-400 bg-primary-100 hover:bg-primary-200 active:bg-primary-300"
3539
/>
3640
</div>

apps/example/components/ColorCard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ export const ColorCard: FC<{
44
className: string;
55
}> = ({ className }) => (
66
<div className="flex gap-2 items-center">
7-
<div className={`rounded shadow w-8 h-8 ${className}`}></div>
7+
<div
8+
className={`rounded-xl relative overflow-hidden w-8 h-8 shadow hover:shadow-lg hover:scale-110 transition-all duration-300 cursor-pointer`}
9+
>
10+
<div className={`${className} absolute inset-0 shadow-inner`} />
11+
</div>
812
{className}
913
</div>
1014
);

apps/example/components/ExampleLayout.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,26 @@ export const ExampleLayout: FC<
99
}>
1010
> = ({ title, subtitle, children, className }) => {
1111
return (
12-
<main className={`min-h-screen ${className}`}>
12+
<main
13+
className={`min-h-screen ${className} transition-colors duration-300`}
14+
>
1315
<div className="container mx-auto p-4 max-w-3xl flex flex-col gap-2">
1416
<nav className="text-sm pb-8 flex gap-4 items-center">
1517
<Link
1618
href="/custom"
17-
className="underline opacity-50 hover:no-underline hover:opacity-100"
19+
className="underline opacity-50 hover:no-underline hover:opacity-100 transition-opacity underline-offset-2 duration-300"
1820
>
1921
custom
2022
</Link>
2123
<Link
2224
href="/radix-colors"
23-
className="underline opacity-50 hover:no-underline hover:opacity-100"
25+
className="underline opacity-50 hover:no-underline hover:opacity-100 transition-opacity underline-offset-2 duration-300"
2426
>
2527
radix colors
2628
</Link>
2729
<Link
2830
href="/tailwind-colors"
29-
className="underline opacity-50 hover:no-underline hover:opacity-100"
31+
className="underline opacity-50 hover:no-underline hover:opacity-100 transition-opacity underline-offset-2 duration-300"
3032
>
3133
tailwind colors
3234
</Link>

apps/example/components/ThemeButton.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22

33
import { FC } from "react";
44

5-
function switchTheme(theme: string) {
5+
function switchTheme(theme: string, bg: string) {
66
if (!theme) {
77
document.documentElement.className = "";
88
} else {
9-
document.documentElement.className = `theme-${theme}`;
9+
document.documentElement.className = `theme-${theme} ${bg}`;
1010
}
1111
}
1212

1313
export const ThemeButton: FC<{
1414
className: string;
1515
theme: string;
16-
}> = ({ theme, className }) => {
16+
bg: string;
17+
}> = ({ theme, bg, className }) => {
1718
return (
1819
<button
19-
onClick={() => switchTheme(theme)}
20-
className={`text-sm px-2 py-1.5 border rounded ${className}`}
20+
onClick={() => switchTheme(theme, bg)}
21+
className={`text-sm px-2 py-1.5 border rounded transition-colors duration-300 ${className}`}
2122
>
2223
{theme}
2324
</button>

0 commit comments

Comments
 (0)