Skip to content

Commit

Permalink
feat: sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
kayyueth committed Nov 25, 2024
1 parent 275ad85 commit 6369679
Show file tree
Hide file tree
Showing 31 changed files with 1,303 additions and 1,055 deletions.
16 changes: 16 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
--chart-3: 197 37% 24%;
--chart-4: 43 74% 66%;
--chart-5: 27 87% 67%;
--sidebar-background: 0 0% 98%;
--sidebar-foreground: 240 5.3% 26.1%;
--sidebar-primary: 240 5.9% 10%;
--sidebar-primary-foreground: 0 0% 98%;
--sidebar-accent: 240 4.8% 95.9%;
--sidebar-accent-foreground: 240 5.9% 10%;
--sidebar-border: 220 13% 91%;
--sidebar-ring: 217.2 91.2% 59.8%;
}

.dark {
Expand Down Expand Up @@ -56,6 +64,14 @@
--chart-3: 30 80% 55%;
--chart-4: 280 65% 60%;
--chart-5: 340 75% 55%;
--sidebar-background: 240 5.9% 10%;
--sidebar-foreground: 240 4.8% 95.9%;
--sidebar-primary: 224.3 76.3% 48%;
--sidebar-primary-foreground: 0 0% 100%;
--sidebar-accent: 240 3.7% 15.9%;
--sidebar-accent-foreground: 240 4.8% 95.9%;
--sidebar-border: 240 3.7% 15.9%;
--sidebar-ring: 217.2 91.2% 59.8%;
}
}

Expand Down
73 changes: 10 additions & 63 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,67 +1,14 @@
import { EnvVarWarning } from '@/components/env-var-warning';
import HeaderAuth from '@/components/header-auth';
import { hasEnvVars } from '@/utils/supabase/check-env-vars';
import { GeistSans } from 'geist/font/sans';
import { ThemeProvider } from 'next-themes';
import Link from 'next/link';
import './globals.css';
import { SidebarProvider, SidebarTrigger } from '@/components/ui/sidebar';
import { AppSidebar } from '@/components/app-sidebar';

const defaultUrl = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: 'http://localhost:3000';

export const metadata = {
metadataBase: new URL(defaultUrl),
title: 'Next.js and Supabase Starter Kit',
description: 'The fastest way to build apps with Next.js and Supabase'
};

export default function RootLayout({
children
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang='en' className={GeistSans.className} suppressHydrationWarning>
<body className='bg-background text-foreground'>
<ThemeProvider
attribute='class'
defaultTheme='system'
enableSystem
disableTransitionOnChange
>
<main className='min-h-screen flex flex-col items-center'>
<div className='flex-1 w-full flex flex-col gap-20 items-center'>
<nav className='w-full flex justify-center border-b border-b-foreground/10 h-16'>
<div className='w-full max-w-5xl flex justify-between items-center p-3 px-5 text-sm'>
<div className='flex gap-5 items-center font-semibold'>
<Link href={'/'}>LOGO HERE</Link>
<div className='flex items-center gap-2'></div>
</div>
{!hasEnvVars ? <EnvVarWarning /> : <HeaderAuth />}
</div>
</nav>
<div className='flex flex-col gap-20 max-w-5xl p-5'>
{children}
</div>

<footer className='w-full flex items-center justify-center border-t mx-auto text-center text-xs gap-8 py-16'>
<p>
Powered by{' '}
<a
href='https://supabase.com/?utm_source=create-next-app&utm_medium=template&utm_term=nextjs'
target='_blank'
className='font-bold hover:underline'
rel='noreferrer'
>
Supabase
</a>
</p>
</footer>
</div>
</main>
</ThemeProvider>
</body>
</html>
<SidebarProvider>
<AppSidebar />
<main>
<SidebarTrigger />
{children}
</main>
</SidebarProvider>
);
}
16 changes: 0 additions & 16 deletions app/page.tsx

This file was deleted.

66 changes: 66 additions & 0 deletions components/app-sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Calendar, Home, Inbox, Search, Settings } from 'lucide-react';
import {
Sidebar,
SidebarContent,
SidebarGroup,
SidebarGroupContent,
SidebarGroupLabel,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem
} from '@/components/ui/sidebar';

// Menu items.
const items = [
{
title: 'Home',
url: '#',
icon: Home
},
{
title: 'Inbox',
url: '#',
icon: Inbox
},
{
title: 'Calendar',
url: '#',
icon: Calendar
},
{
title: 'Search',
url: '#',
icon: Search
},
{
title: 'Settings',
url: '#',
icon: Settings
}
];

export function AppSidebar() {
return (
<Sidebar>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>Application</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
{items.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton asChild>
<a href={item.url}>
<item.icon />
<span>{item.title}</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
</SidebarContent>
</Sidebar>
);
}
33 changes: 0 additions & 33 deletions components/env-var-warning.tsx

This file was deleted.

24 changes: 0 additions & 24 deletions components/form-message.tsx

This file was deleted.

44 changes: 0 additions & 44 deletions components/hero.tsx

This file was deleted.

46 changes: 0 additions & 46 deletions components/next-logo.tsx

This file was deleted.

23 changes: 0 additions & 23 deletions components/submit-button.tsx

This file was deleted.

Loading

0 comments on commit 6369679

Please sign in to comment.