Connect, collaborate, and grow with a community of TypeScript developers
challenge editor border & other stying tweaks (#49)
PickleNik0f2d4efad809
diff --git a/public/favicon.svg b/public/favicon.svgindex 0d7d2b54..dfd54175 100644--- a/public/favicon.svg+++ b/public/favicon.svg@@ -6,7 +6,7 @@<g clip-path="url(#clip0_1_2)"><pathd="M462 0H50C22.3858 0 0 22.3858 0 50V462C0 489.614 22.3858 512 50 512H462C489.614 512 512 489.614 512 462V50C512 22.3858 489.614 0 462 0Z"- fill="#6366f1"+ fill="#3178C6"/><pathfill-rule="evenodd"diff --git a/src/app/layout.tsx b/src/app/layout.tsxindex e8247859..63080209 100644--- a/src/app/layout.tsx+++ b/src/app/layout.tsx@@ -27,7 +27,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })<Providers><Navigation /><main className="flex-1">- <div className="container h-full">{children}</div>+ <div className="h-full">{children}</div></main><Toaster /></Providers>diff --git a/src/components/challenge/description-panel-skeleton.tsx b/src/components/challenge/description-panel-skeleton.tsxindex 06e0f920..d74dc9d6 100644--- a/src/components/challenge/description-panel-skeleton.tsx+++ b/src/components/challenge/description-panel-skeleton.tsx@@ -22,17 +22,17 @@ export function DescriptionPanelSkeleton() {<div className="h-6 w-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div></div><div className="flex flex-col space-y-10">- <div className="prose-invert prose-h3:text-xl flex flex-col space-y-2">+ <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl"><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 w-1/2 rounded-lg bg-slate-300 dark:bg-slate-700"></div></div>- <div className="prose-invert prose-h3:text-xl flex flex-col space-y-2">+ <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl"><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 w-1/2 rounded-lg bg-slate-300 dark:bg-slate-700"></div></div>- <div className="prose-invert prose-h3:text-xl flex flex-col space-y-2">+ <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl"><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 w-1/2 rounded-lg bg-slate-300 dark:bg-slate-700"></div>@@ -42,17 +42,17 @@ export function DescriptionPanelSkeleton() {</TabsContent><TabsContent className="flex h-full flex-col space-y-2 p-5" value="solutions"><div className="flex flex-col space-y-10">- <div className="prose-invert prose-h3:text-xl flex flex-col space-y-2">+ <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl"><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 w-1/2 rounded-lg bg-slate-300 dark:bg-slate-700"></div></div>- <div className="prose-invert prose-h3:text-xl flex flex-col space-y-2">+ <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl"><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 w-1/2 rounded-lg bg-slate-300 dark:bg-slate-700"></div></div>- <div className="prose-invert prose-h3:text-xl flex flex-col space-y-2">+ <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl"><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 rounded-lg bg-slate-300 dark:bg-slate-700"></div><div className="h-4 w-1/2 rounded-lg bg-slate-300 dark:bg-slate-700"></div>diff --git a/src/components/challenge/description-panel.tsx b/src/components/challenge/description-panel.tsxindex bb8403a3..d7ab0a5b 100644--- a/src/components/challenge/description-panel.tsx+++ b/src/components/challenge/description-panel.tsx@@ -60,53 +60,22 @@ export function DescriptionPanel({ challenge }: Props) {}, 500),).current;return (- <div className="flex-1 overflow-y-auto rounded-md bg-white dark:bg-zinc-800">+ <div className="col-span-1 flex-1 overflow-y-auto rounded-xl bg-white dark:bg-zinc-800"><Tabs defaultValue="description" className="w-full">- <TabsList className="sticky top-0 grid w-full grid-cols-2">- <TabsTrigger value="description">Description</TabsTrigger>- <TabsTrigger value="solutions">Solutions</TabsTrigger>+ <TabsList className="sticky top-0 grid w-full grid-cols-2 rounded-xl bg-neutral-200 bg-opacity-70 backdrop-blur-md dark:bg-muted">+ <TabsTrigger className="rounded-lg" value="description">+ Description+ </TabsTrigger>+ <TabsTrigger className="rounded-lg" value="solutions">+ Solutions+ </TabsTrigger></TabsList><TabsContent value="description" className="mt-0">- <div className="h-full p-5">+ <div className="h-full px-1 pb-0 pt-3 dark:px-4 dark:pb-2"><TypographyH3 className="mb-2 font-medium">{challenge.name}</TypographyH3>- <div className="mb-6 flex items-center gap-6">+ <div className="mb-6 flex items-center gap-4"><DifficultyBadge difficulty={challenge.difficulty} />- <Button- className="gap-2 p-1"- variant="ghost"- disabled={!session?.data?.user?.id}- onClick={(): void => {- let shouldIncrement = false;- if (hasVoted) {- setVotes((v) => v - 1);- shouldIncrement = false;- setHasVoted(false);- } else {- setVotes((v) => v + 1);- shouldIncrement = true;- setHasVoted(true);- }- debouncedSearch(- challenge.id,- session?.data?.user?.id as string,- shouldIncrement,- )?.catch((e) => {- console.error(e);- });- }}- >- <ThumbsUp- size={20}- className={clsx(- {- 'fill-green-700 stroke-green-700': hasVoted,- 'stroke-gray-500': !hasVoted,- },- 'hover:stroke-gray-400',- )}- />- <span className="self-end text-lg text-gray-500">{votes}</span>- </Button>+<Buttonvariant="ghost"className="p-1"@@ -142,7 +111,9 @@ export function DescriptionPanel({ challenge }: Props) {</Button><Dialog><DialogTrigger>- <Share size={20} className="stroke-gray-500 hover:stroke-gray-400" />+ <Button variant="ghost" className="p-1">+ <Share size={20} className="stroke-gray-500 hover:stroke-gray-400" />+ </Button></DialogTrigger><DialogContent className="w-[200px]"><DialogHeader>@@ -153,6 +124,53 @@ export function DescriptionPanel({ challenge }: Props) {</DialogHeader></DialogContent></Dialog>+ <Button+ className="group -ml-1 w-14 gap-2 rounded-lg p-1"+ variant="ghost"+ disabled={!session?.data?.user?.id}+ onClick={(): void => {+ let shouldIncrement = false;+ if (hasVoted) {+ setVotes((v) => v - 1);+ shouldIncrement = false;+ setHasVoted(false);+ } else {+ setVotes((v) => v + 1);+ shouldIncrement = true;+ setHasVoted(true);+ }+ debouncedSearch(+ challenge.id,+ session?.data?.user?.id as string,+ shouldIncrement,+ )?.catch((e) => {+ console.error(e);+ });+ }}+ >+ <ThumbsUp+ size={20}+ className={clsx(+ {+ 'fill-emerald-600 stroke-emerald-600 group-hover:stroke-emerald-500 dark:fill-emerald-400 dark:stroke-emerald-400':+ hasVoted,+ 'stroke-zinc-500': !hasVoted,+ },+ 'duration-300 group-hover:stroke-zinc-400',+ )}+ />+ <span+ className={clsx(+ {+ 'text-emerald-600 dark:text-emerald-400': hasVoted,+ 'text-zinc-500 group-hover:text-zinc-400': !hasVoted,+ },+ 'self-end text-lg duration-300',+ )}+ >+ {votes}+ </span>+ </Button></div><div className="prose-invert leading-8 prose-h3:text-xl">{/* @ts-ignore */}@@ -166,6 +184,7 @@ export function DescriptionPanel({ challenge }: Props) {<SyntaxHighlighter// @ts-ignorestyle={vscDarkPlus} // theme+ className="rounded-xl dark:rounded-md"language={match[1]}PreTag="section" // parent tag{...props}diff --git a/src/components/challenge/editor/index.tsx b/src/components/challenge/editor/index.tsxindex d2e6f485..9b88df1b 100644--- a/src/components/challenge/editor/index.tsx+++ b/src/components/challenge/editor/index.tsx@@ -154,16 +154,16 @@ export const CodePanel = ({ prompt }: Props) => {};return (- <div className="flex flex-1 flex-col overflow-hidden rounded-md">- <div className="container sticky top-0 flex h-[40px] flex-row-reverse items-center border border-b-zinc-300 bg-muted py-2 dark:border-b-zinc-700">+ <div className="col-span-2 flex flex-1 flex-col overflow-hidden rounded-xl border border-zinc-300 dark:border-zinc-700">+ <div className="container sticky top-0 flex h-[40px] flex-row-reverse items-center border-b border-zinc-300 py-2 dark:border-zinc-700 dark:bg-[#1e1e1e]"><Dialog><DialogTrigger>- <Settings size={20} className="stroke-gray-500 hover:stroke-gray-400" />+ <Settings size={20} className="stroke-zinc-500 stroke-1 hover:stroke-zinc-400" /></DialogTrigger><DialogContent className="w-[200px]"><DialogHeader><DialogTitle>Settings</DialogTitle>- <div className="py-4">+ <div className="pt-4"><SettingsForm /></div></DialogHeader>@@ -181,13 +181,13 @@ export const CodePanel = ({ prompt }: Props) => {onChange={(code) => setCode(code ?? '')}/></div>- <div className="sticky bottom-0 flex items-center justify-between bg-muted p-2">+ <div className="sticky bottom-0 flex items-center justify-between p-2 dark:bg-[#1e1e1e]">{editorState && <VimStatusBar editor={editorState} />}{/* some hacky stuff to avoid layout shift. fix if you want */}{!editorState && <div />}<Buttonsize="sm"- className="bg-green-300 hover:bg-green-400 dark:hover:bg-green-200"+ className="bg-emerald-600 duration-300 hover:bg-emerald-500 dark:bg-emerald-300 dark:hover:bg-emerald-400"onClick={handleSubmit}disabled={!initialTypecheckDone}>diff --git a/src/components/challenge/index.tsx b/src/components/challenge/index.tsxindex 64abd8aa..442f7163 100644--- a/src/components/challenge/index.tsx+++ b/src/components/challenge/index.tsx@@ -36,7 +36,7 @@ export async function Challenge({ id }: Props) {return (<div- className="flex flex-col gap-2 py-4 md:flex-row"+ className="flex flex-col gap-2 px-4 pb-4 lg:flex-row 2xl:grid 2xl:grid-cols-3"style={{ height: 'calc(100dvh - 3.5rem)' }}><DescriptionPanel challenge={challenge} />diff --git a/src/components/challenge/skeleton.tsx b/src/components/challenge/skeleton.tsxindex 3a2dc77e..d8cb159d 100644--- a/src/components/challenge/skeleton.tsx+++ b/src/components/challenge/skeleton.tsx@@ -2,7 +2,10 @@ import { DescriptionPanelSkeleton } from './description-panel-skeleton';export function ChallengeSkeleton() {return (- <div className="flex h-full gap-2 p-4">+ <div+ className="flex flex-col gap-2 px-4 pb-4 md:flex-row 2xl:grid 2xl:grid-cols-3"+ style={{ height: 'calc(100dvh - 3.5rem)' }}+ ><DescriptionPanelSkeleton /><div className="flex h-full flex-1 flex-col"></div></div>diff --git a/src/components/explore/index.tsx b/src/components/explore/index.tsxindex 078cb0b6..858fbab2 100644--- a/src/components/explore/index.tsx+++ b/src/components/explore/index.tsx@@ -7,9 +7,9 @@ import { ExploreSectionSkeleton } from './section-skeleton';export function Explore() {return (- <div className="flex h-full flex-col">- <section className="mb-8 flex max-w-[69ch] flex-col items-start gap-2 pt-4 md:pt-8">- <TypographyH1 className="bg-gradient-to-r from-[#3178C6] to-pink-500 bg-clip-text text-transparent dark:to-pink-400">+ <div className="container flex h-full flex-col">+ <section className="mb-8 flex max-w-[69ch] flex-col items-start gap-2 px-2 pt-4 md:pt-8">+ <TypographyH1 className="bg-gradient-to-r from-[#3178C6] from-30% to-black bg-clip-text text-transparent dark:to-white">Explore</TypographyH1><TypographyP>diff --git a/src/components/ui/navigation.tsx b/src/components/ui/navigation.tsxindex 74869589..bd3a60fc 100644--- a/src/components/ui/navigation.tsx+++ b/src/components/ui/navigation.tsx@@ -61,7 +61,7 @@ export function Navigation() {<div className="relative flex basis-1/3"><a className="flex items-center space-x-2 duration-300" href="/"><svg- className="h-6 w-6 rounded-md bg-[#3178C6] p-[2px]"+ className="ml-2 h-6 w-6 rounded-md bg-[#3178C6] p-[2px]"viewBox="0 0 512 512"xmlns="http://www.w3.org/2000/svg">@@ -104,7 +104,7 @@ export function Navigation() {</NavigationMenuLink></Link></NavigationMenuItem>- <NavigationMenuItem className="hidden sm:block">+ <NavigationMenuItem className="sm:block hidden"><NavigationMenuTrigger>Something Nice</NavigationMenuTrigger><NavigationMenuContent><NavigationMenuLink>Nice</NavigationMenuLink>diff --git a/src/components/user/profile.tsx b/src/components/user/profile.tsxindex d47f4ad5..83f46af8 100644--- a/src/components/user/profile.tsx+++ b/src/components/user/profile.tsx@@ -20,7 +20,7 @@ export async function Profile({ username: usernameFromQuery }: Props) {}return (- <>+ <div className="container"><h1>{user.id}</h1><Image alt="user avatar" width="100" height="100" src={user.image ?? ''} />@@ -29,6 +29,6 @@ export async function Profile({ username: usernameFromQuery }: Props) {<h2 className="text-xl">Raw user:</h2><pre>{JSON.stringify(user, null, 4)}</pre>{/* <button onClick={() => handleClick(user.id)}>update user name for id: {user.id}</button> */}- </>+ </div>);}diff --git a/tailwind.config.ts b/tailwind.config.tsindex 029d7a34..3f945f7d 100644--- a/tailwind.config.ts+++ b/tailwind.config.ts@@ -13,6 +13,10 @@ module.exports = {},},extend: {+ screens: {+ // iPad Pro vertical is 1024px exactly+ lg: '1025px',+ },colors: {border: 'hsl(var(--border))',input: 'hsl(var(--input))',