Skip to content

Commit f6043d8

Browse files
authored
fix(examples): make next-rwa example for dark mode
2 parents 6389ee5 + ca359d5 commit f6043d8

18 files changed

Lines changed: 537 additions & 35 deletions

File tree

examples/next-rwa/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@
1212
"dependencies": {
1313
"@auth0/nextjs-auth0": "^4.13.2",
1414
"@auth0/universal-components-react": "workspace:*",
15+
"@radix-ui/react-slot": "^1.2.3",
1516
"@tailwindcss/postcss": "^4.1.17",
17+
"class-variance-authority": "^0.7.1",
18+
"clsx": "^2.1.1",
1619
"execa": "^9.1.0",
1720
"i18next": "^25.2.1",
1821
"lucide-react": "^0.511.0",
1922
"next": "16.1.5",
2023
"ora": "^8.0.1",
2124
"postcss": "^8.5.5",
25+
"radix-ui": "^1.4.3",
2226
"react": "^19.2.1",
2327
"react-dom": "^19.2.1",
2428
"react-hook-form": "^7.57.0",
2529
"react-i18next": "^15.5.3",
30+
"tailwind-merge": "^3.5.0",
2631
"tailwindcss": "^4.1.17"
2732
},
2833
"devDependencies": {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use client';
22

3-
import { DomainTable } from '@auth0/universal-components-react/rwa';
3+
// import { DomainTable } from '@auth0/universal-components-react/rwa';
44

55
export default function DomainManagementPage() {
66
return (
77
<div className="p-6 pt-8 space-y-6">
8-
<p>
8+
<p className="text-primary">
99
Follow{' '}
1010
<a
1111
href="https://github.com/auth0/auth0-ui-components/tree/main/examples/next-rwa#adding-a-universal-component-to-your-app"
@@ -15,7 +15,7 @@ export default function DomainManagementPage() {
1515
</a>{' '}
1616
on how to add Domain Management component.
1717
</p>
18-
<DomainTable />
18+
{/* <DomainTable /> */}
1919
</div>
2020
);
2121
}

examples/next-rwa/src/app/globals.css

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
11
/* Import Tailwind CSS v4 */
22
@import 'tailwindcss';
3+
@import '../styles/light.css';
4+
@import '../styles/dark.css';
35
@import '@auth0/universal-components-react/styles';
46

57
@theme {
6-
--color-background: var(--background);
8+
--color-page: var(--color-page);
9+
--color-background: var(--color-background);
10+
--color-foreground: var(--color-foreground);
11+
12+
--color-card: var(--color-card);
13+
--color-card-foreground: var(--color-card-foreground);
14+
15+
--color-primary: var(--color-primary);
16+
--color-primary-foreground: var(--color-primary-foreground);
17+
18+
--color-accent: var(--color-accent);
19+
--color-accent-foreground: var(--color-accent-foreground);
20+
21+
--color-muted: var(--color-muted);
22+
--color-muted-foreground: var(--color-muted-foreground);
23+
24+
--color-border: var(--color-border);
25+
--color-ring: oklch(from var(--color-ring) l c h / 50%);
726
}
827

928
/* Minimal Next.js specific fixes - keep only essential z-index fixes */
@@ -26,5 +45,4 @@ body {
2645
min-width: 320px;
2746
min-height: 100vh;
2847
height: 100%;
29-
background-color: white;
3048
}

examples/next-rwa/src/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const metadata: Metadata = {
1919
export default function RootLayout({ children }: { children: React.ReactNode }) {
2020
return (
2121
<html lang="en" className="h-full">
22-
<body className={`${inter.className} h-full`}>
22+
<body className={`${inter.className} h-full overflow-hidden bg-background`}>
2323
<Auth0Provider>
2424
<ClientProvider>
2525
<div className="flex flex-col h-screen bg-background">

examples/next-rwa/src/app/organization-management/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { OrganizationDetailsEdit } from '@auth0/universal-components-react/rwa';
44

55
export default function OrganizationManagementPage() {
66
return (
7-
<div className="p-6 pt-8 space-y-6">
7+
<div className="space-y-6">
88
<OrganizationDetailsEdit />
99
</div>
1010
);

examples/next-rwa/src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { HeroSection } from '@/components/hero-section';
22

33
export default function HomePage() {
44
return (
5-
<main className="bg-white pt-16">
5+
<main>
66
<HeroSection />
77
</main>
88
);

examples/next-rwa/src/components/hero-section.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use client';
22

3-
import React from 'react';
43
import { useTranslation } from 'react-i18next';
4+
import { Button } from './ui/button';
55

66
export function HeroSection() {
77
const { t } = useTranslation();
88

99
return (
10-
<div className="dark:bg-gray-900">
10+
<div>
1111
<div className="relative isolate px-6 lg:px-8 flex items-center">
1212
<div className="mx-auto max-w-2xl py-32 sm:py-48 lg:py-56">
1313
<div className="text-center">
@@ -17,20 +17,22 @@ export function HeroSection() {
1717
<p className="mt-6 text-lg leading-8 text-gray-600 dark:text-gray-300">
1818
{t('hero-section.description')}
1919
</p>
20+
2021
<div className="mt-10 flex items-center justify-center gap-x-6">
21-
<a
22-
href="https://auth0-ui-components.vercel.app/"
23-
target="_blank"
24-
rel="noopener noreferrer"
25-
className="px-5 py-2 mt-6 text-sm font-medium leading-5 text-center text-white capitalize bg-slate-900 rounded-lg hover:bg-slate-700 lg:mx-0 lg:w-auto focus:outline-none"
26-
>
27-
{t('hero-section.get-started-button')}
28-
</a>
22+
<Button className="cursor-pointer">
23+
<a
24+
href="https://auth0-ui-components.vercel.app/"
25+
target="_blank"
26+
rel="noopener noreferrer"
27+
>
28+
{t('hero-section.get-started-button')}
29+
</a>
30+
</Button>
2931
<a
3032
href="https://auth0.com/docs"
3133
target="_blank"
3234
rel="noopener noreferrer"
33-
className="px-5 py-2 mt-6 text-sm font-semibold leading-6 text-gray-900 dark:text-white"
35+
className="px-5 py-2 text-sm font-semibold leading-6 text-gray-900 dark:text-white"
3436
>
3537
{t('hero-section.learn-more-button')}
3638
<span aria-hidden="true"></span>

examples/next-rwa/src/components/navigation/navbar.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,33 @@
22

33
import { useUser } from '@auth0/nextjs-auth0';
44
import Link from 'next/link';
5+
import { useRouter } from 'next/navigation';
56
import type React from 'react';
67
import { useTranslation } from 'react-i18next';
7-
8+
import { useDarkMode } from '@/hooks/use-dark-mode';
89
import { ProfileDropdown } from './profile-dropdown';
10+
import { Button } from '../ui/button';
11+
12+
const LOGO_ON_LIGHT =
13+
'https://cdn.auth0.com/quantum-assets/dist/2.0.2/logos/auth0/auth0-lockup-en-onlight.svg';
14+
const LOGO_ON_DARK =
15+
'https://cdn.auth0.com/quantum-assets/dist/2.0.2/logos/auth0/auth0-lockup-en-ondark.svg';
916

1017
export function Navbar() {
1118
const { user, isLoading } = useUser();
19+
const router = useRouter();
1220
const { t } = useTranslation();
21+
const isDarkMode = useDarkMode();
1322

1423
return (
1524
<header className="w-full h-16 z-50">
16-
<nav className=" border-b border-gray-200 px-4 py-3 shadow-sm dark:bg-gray-900 dark:border-gray-700 h-full">
25+
<nav className="px-4 py-3 shadow-sm h-full bg-white dark:bg-black">
1726
<div className="mx-auto flex justify-between items-center px-4 sm:px-6 lg:px-8 h-full">
1827
<div className="flex lg:flex-1">
1928
<Link href="/" className="-m-1.5 p-1.5">
2029
<img
2130
className="h-8 w-auto"
22-
src="https://cdn.auth0.com/quantum-assets/dist/2.0.2/logos/auth0/auth0-lockup-en-onlight.svg"
31+
src={isDarkMode ? LOGO_ON_DARK : LOGO_ON_LIGHT}
2332
alt="auth0 logo"
2433
/>
2534
</Link>
@@ -30,12 +39,9 @@ export function Navbar() {
3039
(user ? (
3140
<ProfileDropdown />
3241
) : (
33-
<a
34-
className="px-4 py-2 text-sm font-medium leading-5 text-center text-white capitalize bg-slate-900 rounded-lg hover:bg-slate-700 lg:mx-0 lg:w-auto focus:outline-none"
35-
href="/auth/login"
36-
>
42+
<Button className="cursor-pointer" onClick={() => router.push('/auth/login')}>
3743
{t('nav-bar.sign-in-button')}
38-
</a>
44+
</Button>
3945
))}
4046
</div>
4147
</div>

examples/next-rwa/src/components/navigation/profile-dropdown.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function ProfileDropdown() {
3434
<div className="relative" ref={dropdownRef}>
3535
<button
3636
onClick={() => setIsOpen(!isOpen)}
37-
className="flex items-center space-x-2 p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800"
37+
className="flex items-center space-x-2 p-2 rounded-md transition-colors hover:bg-accent/60"
3838
>
3939
{user.picture ? (
4040
<img className="h-8 w-8 rounded-full" src={user.picture} alt={user.name || 'Profile'} />
@@ -49,10 +49,10 @@ export function ProfileDropdown() {
4949
</button>
5050

5151
{isOpen && (
52-
<div className="absolute right-0 mt-2 w-48 bg-gray-800 rounded-md shadow-lg py-1 z-50 border border-gray-700">
52+
<div className="absolute right-0 mt-2 w-48 bg-card rounded-md shadow-lg py-1 z-50 border border-gray-700">
5353
<Link
5454
href="/profile"
55-
className="block px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"
55+
className="block px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:hover:bg-accent/60"
5656
onClick={() => setIsOpen(false)}
5757
>
5858
<div className="flex items-center space-x-2">
@@ -62,7 +62,7 @@ export function ProfileDropdown() {
6262
</Link>
6363
<a
6464
href="/auth/logout"
65-
className="block px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"
65+
className="block px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-accent/60"
6666
>
6767
<div className="flex items-center space-x-2">
6868
<LogOut className="h-4 w-4" />

examples/next-rwa/src/components/navigation/side-bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const Sidebar: React.FC = () => {
1313
const { t } = useTranslation();
1414
return (
1515
user && (
16-
<div className="w-64 flex-shrink-0 bg-gray-900 border-r border-gray-700 shadow-lg pt-4 overflow-y-auto">
16+
<div className="w-64 flex-shrink-0 bg-white dark:bg-black shadow-lg pt-4 h-full">
1717
<div className="p-4 space-y-6">
1818
{/* My Account Section */}
1919
{featuresConfig.enableMyAccount && (

0 commit comments

Comments
 (0)