Skip to content

Commit

Permalink
some responsiveness but still need to figure out what to do with the …
Browse files Browse the repository at this point in the history
…editor in the generator for mobile
  • Loading branch information
RodrigoLuglio committed Oct 14, 2024
1 parent 5790680 commit d4681b8
Show file tree
Hide file tree
Showing 12 changed files with 315 additions and 34 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@monaco-editor/react": "^4.6.0",
"@next/env": "^14.2.13",
"@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-select": "^2.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/app/(private)/saved-themes/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async function SavedThemesPage() {
auth().protect()

return (
<main className="mx-auto p-20">
<main className="mx-auto p-4 md:p-20">
{themes.length === 0 ? (
<div className="text-center py-8">
<h2 className="text-2xl font-semibold mb-4">No Saved Themes</h2>
Expand Down
8 changes: 5 additions & 3 deletions src/app/discover/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ export default async function DiscoverPage() {
const themes = await getPublicThemes()
return (
<div>
<main className="mx-auto">
<main className="mx-auto px-3 md:px-0">
<div className="flex flex-col gap-10 items-center w-full">
<div className="relative w-full">
<DotPattern cr={0.3} className="absolute top-0 z-20" />
<div className="h-[500px] flex flex-col items-center justify-center w-full">
<h1 className="text-5xl font-bold mb-4">Discover new themes</h1>
<h2 className="text-3xl font-semibold text-muted-foreground">
<h1 className="text-2xl md:text-5xl font-bold mb-4">
Discover new themes
</h1>
<h2 className="text-lg md:text-3xl font-semibold text-muted-foreground">
made by the community
</h2>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { auth } from '@clerk/nextjs/server'
import { dark } from '@clerk/themes'

import { Toaster } from '@/components/ui/toaster'
import Navigation from '@/components/Navigation'
import { Navigation } from '@/components/Navigation'
import { ThemeProvider as ThemeProviderContext } from '@/contexts/ThemeContext'

import { Analytics } from '@vercel/analytics/react'
Expand Down
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function Home() {
Visual Studio Code.
</p>
</div>
<div className="flex items-stretch justify-center gap-10">
<div className="flex flex-wrap md:flex-nowrap items-stretch justify-center gap-10">
<Card className="flex-1">
<CardHeader>
<CardTitle>Discover Themes</CardTitle>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Discover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function Discover({ themes }: { themes: SavedTheme[] }) {
<ThemePreviewSmall theme={selectedTheme} />
</div>

<div className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-16 p-20">
<div className="grid grid-cols-1 sm:grid-cols-3 lg:grid-cols-4 gap-16 p-0 md:p-20">
{themes.map((theme) => (
<ThemeCardPublic
key={theme.id}
Expand Down
186 changes: 162 additions & 24 deletions src/components/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,176 @@
'use client'

import * as React from 'react'
import Link from 'next/link'
import { usePathname } from 'next/navigation'
import {
UserButton,
SignInButton,
SignUpButton,
SignedIn,
SignedOut,
} from '@clerk/nextjs'
import { Button } from './ui/button'
import { cn } from '@/lib/utils'
import { Button } from '@/components/ui/button'
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet'
import { Menu, X } from 'lucide-react'

const routes = [
{
href: '/',
label: 'VSCode Themes Community',
},
{
href: '/discover',
label: 'Discover',
},
{
href: '/generator',
label: 'Create',
},
{
href: '/saved-themes',
label: 'Your Themes',
},
]

export function Navigation() {
const [isOpen, setIsOpen] = React.useState(false)
const pathname = usePathname()

const Navigation = () => {
return (
<nav className="bg-background text-foreground p-4 sticky top-0 z-50 shadow-b-xl border-b border-border">
<div className="mx-auto flex justify-between items-center">
<Link href="/" className="text-xl font-bold">
VSCode Themes Community
</Link>
<div className="flex gap-4 items-center ">
<Link href="/discover">Discover</Link>
<Link href="/generator">Create</Link>
<SignedIn>
<Link href="/saved-themes">Your Themes</Link>
<UserButton />
</SignedIn>
<SignedOut>
<SignInButton mode="modal">
<Button>Sign In</Button>
</SignInButton>
<SignUpButton mode="modal">
<Button variant="secondary">Sign Up</Button>
</SignUpButton>
</SignedOut>
<header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
<div className="p-4">
<div className="hidden md:flex h-full justify-between items-center">
<Link href="/" className="font-bold">
VSCode Themes Community
</Link>
<div className="flex gap-4 items-center text-base">
<Link
className={cn(
'transition-colors hover:text-foreground/80',
pathname === '/discover'
? 'text-foreground'
: 'text-foreground/60'
)}
href="/discover"
>
Discover
</Link>
<Link
className={cn(
'transition-colors hover:text-foreground/80',
pathname === '/generator'
? 'text-foreground'
: 'text-foreground/60'
)}
href="/generator"
>
Create
</Link>
<SignedIn>
<Link
className={cn(
'transition-colors hover:text-foreground/80',
pathname === '/saved-themes'
? 'text-foreground'
: 'text-foreground/60'
)}
href="/saved-themes"
>
Your Themes
</Link>
<UserButton />
</SignedIn>
<SignedOut>
<SignInButton mode="modal">
<Button size="sm">Sign In</Button>
</SignInButton>
<SignUpButton mode="modal">
<Button size="sm" variant="secondary">
Sign Up
</Button>
</SignUpButton>
</SignedOut>
</div>
</div>
<Sheet open={isOpen} onOpenChange={setIsOpen}>
<SheetTrigger asChild>
<Button
variant="ghost"
className="mr-2 px-0 text-base hover:bg-transparent focus-visible:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 md:hidden"
>
<Menu className="h-6 w-6" />
<span className="sr-only">Toggle Menu</span>
</Button>
</SheetTrigger>
<SheetContent side="left" className="pr-0">
<MobileLink
href="/"
className="flex items-center"
onOpenChange={setIsOpen}
>
<span className="font-bold">VSCode Themes Community</span>
</MobileLink>
<div className="my-4 h-[calc(100vh-8rem)] pb-10 pl-6">
<div className="flex flex-col space-y-3">
<MobileLink href="/discover" onOpenChange={setIsOpen}>
Discover
</MobileLink>
<MobileLink href="/generator" onOpenChange={setIsOpen}>
Create
</MobileLink>
<SignedIn>
<MobileLink href="/saved-themes" onOpenChange={setIsOpen}>
Your Themes
</MobileLink>
<UserButton />
</SignedIn>
<SignedOut>
<SignInButton mode="modal">
<Button size="sm">Sign In</Button>
</SignInButton>
<SignUpButton mode="modal">
<Button size="sm" variant="secondary">
Sign Up
</Button>
</SignUpButton>
</SignedOut>
</div>
</div>
</SheetContent>
</Sheet>
</div>
</nav>
</header>
)
}

interface MobileLinkProps extends React.PropsWithChildren {
href: string
onOpenChange?: (open: boolean) => void
className?: string
}

function MobileLink({
href,
onOpenChange,
className,
children,
}: MobileLinkProps) {
const pathname = usePathname()
const isActive = pathname === href

return (
<Link
href={href}
onClick={() => onOpenChange?.(false)}
className={cn(
className,
'text-foreground/70 transition-colors hover:text-foreground',
isActive && 'text-foreground'
)}
>
{children}
</Link>
)
}
export default Navigation
2 changes: 1 addition & 1 deletion src/components/SavedThemes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function SavedThemesContent({
<div className="sticky top-[3.5rem] py-5 z-20 bg-background/70 shadow-sm backdrop-blur backdrop w-full">
<ThemePreviewSmall theme={selectedTheme} />
</div>
<div className="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-16">
<div className="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-10 md:gap-16">
{themes.map((theme) => (
<ThemeCard
key={theme.id}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SyntaxColorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const ColorList: React.FC<ColorListProps> = ({ title, isThemeColors }) => {
Unlock All
</Button>
</div>
<div className="grid grid-rows-4 grid-flow-col auto-cols-auto gap-3 w-full">
<div className="grid grid-cols-1 md:grid-rows-4 md:grid-flow-col md:auto-cols-auto gap-3 w-full">
{Object.entries(displayColors).map(([key, value]) => (
<div
key={key}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ThemePreviewSmall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function ThemePreviewSmall({ theme }: { theme: SavedTheme }) {
style={{ backgroundColor: theme.uiColors.BG1 }}
>
<div
className="pl-2 py-2 w-1/3 flex flex-col items-end justify-center"
className="pl-2 py-2 w-1/3 flex flex-col items-end justify-center overflow-hidden"
style={{ backgroundColor: theme.uiColors.BG1 }}
>
<h2
Expand Down
Loading

0 comments on commit d4681b8

Please sign in to comment.