Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

Create challenge styling, covert assets/images .pngs to .webps (#324)

PickleNik197ce5f53f88
diff --git a/src/assets/images/background_pattern.png b/src/assets/images/background_pattern.png
deleted file mode 100644
index b20d82d8..00000000
Binary files a/src/assets/images/background_pattern.png and /dev/null differ
diff --git a/src/assets/images/background_pattern.webp b/src/assets/images/background_pattern.webp
new file mode 100644
index 00000000..d1d8baa1
Binary files /dev/null and b/src/assets/images/background_pattern.webp differ
diff --git a/src/assets/images/background_pattern_flipped.png b/src/assets/images/background_pattern_flipped.png
deleted file mode 100644
index a75ae080..00000000
Binary files a/src/assets/images/background_pattern_flipped.png and /dev/null differ
diff --git a/src/assets/images/background_pattern_flipped.webp b/src/assets/images/background_pattern_flipped.webp
new file mode 100644
index 00000000..5a4e48fc
Binary files /dev/null and b/src/assets/images/background_pattern_flipped.webp differ
diff --git a/src/assets/images/waitlist-bg-blurbed.png b/src/assets/images/waitlist-bg-blurbed.png
deleted file mode 100644
index 15ad572e..00000000
Binary files a/src/assets/images/waitlist-bg-blurbed.png and /dev/null differ
diff --git a/src/assets/images/waitlist-bg.png b/src/assets/images/waitlist-bg.png
deleted file mode 100644
index c6c9b0ef..00000000
Binary files a/src/assets/images/waitlist-bg.png and /dev/null differ
diff --git a/src/assets/images/waitlist-bg.webp b/src/assets/images/waitlist-bg.webp
new file mode 100644
index 00000000..c14ddd9c
Binary files /dev/null and b/src/assets/images/waitlist-bg.webp differ
diff --git a/src/components/explore/explore-card.tsx b/src/components/explore/explore-card.tsx
index 319fdd11..0747f8d3 100644
--- a/src/components/explore/explore-card.tsx
+++ b/src/components/explore/explore-card.tsx
@@ -47,7 +47,7 @@ const GRADIENTS_BY_DIFFICULTY = {
export const ExploreCard = ({ challenge }: ExploreCardProps) => {
return (
<Card
- className={`group relative overflow-hidden duration-300
+ className={`group relative overflow-hidden duration-300 sm:min-w-[300px] xl:min-w-[382px]
${GRADIENTS_BY_DIFFICULTY[challenge.difficulty]}
${SHADOWS_BY_DIFFICULTY[challenge.difficulty]}
${BORDERS_BY_DIFFICULTY[challenge.difficulty]}
@@ -61,20 +61,20 @@ export const ExploreCard = ({ challenge }: ExploreCardProps) => {
)}
{challenge.difficulty === 'EASY' && (
<>
- <Diamond className="absolute -right-5 -top-10 h-24 w-24 origin-top-right stroke-1 text-white/30 duration-300 group-hover:scale-90 dark:group-hover:text-black/30"></Diamond>
- <Diamond className="absolute -right-5 -top-10 h-32 w-32 rotate-12 stroke-1 text-white/30 duration-300 group-hover:-translate-y-2 group-hover:translate-x-2 group-hover:-rotate-12 group-hover:scale-90 dark:group-hover:text-black/30"></Diamond>
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 origin-top-right stroke-1 text-white/30 duration-300 group-hover:rotate-6 group-hover:scale-90 dark:group-hover:text-black/30"></Diamond>
+ <Diamond className="absolute -right-6 -top-12 h-36 w-36 rotate-12 stroke-[0.75] text-white/30 duration-300 group-hover:-translate-y-2 group-hover:translate-x-3 group-hover:rotate-6 group-hover:scale-90 dark:group-hover:text-black/30"></Diamond>
</>
)}
{challenge.difficulty === 'MEDIUM' && (
<>
- <Triangle className="absolute -right-4 -top-6 h-20 w-20 rotate-[40deg] stroke-2 text-white/50 duration-200 group-hover:rotate-0 group-hover:scale-50 dark:group-hover:text-black/30"></Triangle>
- <Triangle className="absolute -right-12 -top-14 h-36 w-36 rotate-45 stroke-1 text-white/50 duration-300 group-hover:h-32 group-hover:w-32 group-hover:rotate-[20deg] dark:group-hover:text-black/30"></Triangle>
+ <Triangle className="absolute -right-5 -top-5 h-16 w-16 rotate-0 stroke-2 text-white/50 duration-500 group-hover:-translate-x-10 group-hover:translate-y-10 group-hover:rotate-[90deg] dark:group-hover:text-black/30"></Triangle>
+ <Triangle className="absolute -right-14 -top-16 h-36 w-36 rotate-0 stroke-1 text-white/50 duration-300 group-hover:translate-x-3 group-hover:rotate-[30deg] group-hover:scale-50 group-hover:stroke-2 dark:group-hover:text-black/30"></Triangle>
</>
)}
{challenge.difficulty === 'HARD' && (
<>
<Plus className="absolute -right-4 -top-8 h-24 w-24 stroke-1 text-white/30 duration-300 group-hover:scale-0 dark:group-hover:text-black/30"></Plus>
- <Plus className="absolute -right-4 -top-8 h-32 w-32 stroke-1 text-white/30 duration-500 group-hover:scale-[3] dark:group-hover:text-black/30"></Plus>
+ <Plus className="absolute -right-4 -top-8 h-32 w-32 stroke-1 text-white/30 duration-500 group-hover:-translate-y-5 group-hover:translate-x-5 group-hover:-rotate-90 group-hover:scale-75 dark:group-hover:text-black/30"></Plus>
</>
)}
{challenge.difficulty === 'EXTREME' && (
diff --git a/src/components/explore/index.tsx b/src/components/explore/index.tsx
index 1eb8d12e..010fac4c 100644
--- a/src/components/explore/index.tsx
+++ b/src/components/explore/index.tsx
@@ -8,12 +8,11 @@ export const dynamic = 'force-dynamic';
export async function Explore() {
return (
- <div className="container flex h-full flex-col items-center">
- <p className="max-w-[66ch] px-4 pt-5 text-lg leading-10 text-neutral-600 dark:text-neutral-400 md:text-center">
- <span className="text-xl font-bold text-[#3178c6] dark:text-[#4e99ea]">Explore</span> the
- challenges. Embrace the opportunity to grow, learn, and showcase your programming abilities.
- We hope you find the <span className="font-semibold dark:text-neutral-200">perfect</span>{' '}
- challenge!
+ <div className="container flex flex-col items-center gap-8 py-5 md:gap-20 md:pb-20">
+ <p className="max-w-[66ch] px-4 text-lg leading-10 text-neutral-600 dark:text-neutral-400 md:text-center">
+ Explore the challenges. Embrace the opportunity to grow, learn, and showcase your
+ programming abilities. We hope you find the{' '}
+ <span className="font-semibold dark:text-neutral-200">perfect</span> challenge!
</p>
<Suspense fallback={<ExploreSectionSkeleton />}>
<ExploreSection title="Great for Beginners" fetcher={getEasyChallenges} />
diff --git a/src/components/explore/section.tsx b/src/components/explore/section.tsx
index 5ef41cff..219a1ac8 100644
--- a/src/components/explore/section.tsx
+++ b/src/components/explore/section.tsx
@@ -5,7 +5,7 @@ import { ExploreCard } from './explore-card';
import type { ExploreChallengeFetcher } from '.';
import type { Difficulty } from '@prisma/client';
import { Button } from '../ui/button';
-import { ChevronRight } from 'lucide-react';
+import { ChevronRight, Circle, Diamond, Plus, Sparkle, Triangle } from 'lucide-react';
interface Props {
title: string;
@@ -21,32 +21,79 @@ const difficultyToNumber: Record<Difficulty, number> = {
};
const COLORS_BY_DIFFICULTY = {
- BEGINNER: 'dark:text-pink-400 text-pink-600',
- EASY: 'dark:text-green-400 text-green-600',
- MEDIUM: 'dark:text-yellow-400 text-yellow-600',
- HARD: 'dark:text-red-400 text-red-600',
- EXTREME: 'dark:text-orange-400 text-orange-600',
+ BEGINNER: 'bg-gradient-to-r from-50% from-pink-600/10 dark:from-pink-500/10',
+ EASY: 'bg-gradient-to-r from-50% from-green-600/10 dark:from-green-500/10',
+ MEDIUM: 'bg-gradient-to-r from-50% from-yellow-600/10 dark:from-yellow-500/10',
+ HARD: 'bg-gradient-to-r from-50% from-red-600/10 dark:from-red-500/10',
+ EXTREME: 'bg-gradient-to-r from-50% from-orange-600/10 dark:from-orange-500/10',
};
+const TITLES_BY_DIFFICULTY = {
+ BEGINNER: 'bg-gradient-to-r from-pink-500 to-pink-500 dark:from-pink-500 dark:to-pink-200',
+ EASY: 'bg-gradient-to-r from-green-500 to-green-500 dark:from-green-500 dark:to-green-200',
+ MEDIUM: 'bg-gradient-to-r from-yellow-500 to-yellow-600 dark:from-yellow-500 dark:to-yellow-200',
+ HARD: 'bg-gradient-to-r from-red-500 to-red-500 dark:from-red-500 dark:to-red-200',
+ EXTREME: 'bg-gradient-to-r from-orange-500 to-orange-500 dark:from-orange-500 dark:to-orange-200',
+};
+
+const BUTTONS_BY_DIFFICULTY = {
+ BEGINNER:
+ 'bg-pink-500/10 text-pink-700 hover:text-pink-700 dark:text-pink-300 dark:bg-pink-300/10 hover:bg-pink-500/20 dark:hover:bg-pink-300/20',
+ EASY: 'bg-green-500/10 text-green-700 hover:text-green-700 dark:text-green-300 dark:bg-green-300/10 hover:bg-green-500/20 dark:hover:bg-green-300/20',
+ MEDIUM:
+ 'bg-yellow-500/10 text-yellow-700 hover:text-yellow-700 dark:text-yellow-300 dark:bg-yellow-300/10 hover:bg-yellow-500/20 dark:hover:bg-yellow-300/20',
+ HARD: 'bg-red-500/10 text-red-700 hover:text-red-700 dark:text-red-300 dark:bg-red-300/10 hover:bg-red-500/20 dark:hover:bg-red-300/20',
+ EXTREME:
+ 'bg-orange-500/10 text-orange-700 hover:text-orange-700 dark:text-orange-300 dark:bg-orange-300/10 hover:bg-orange-500/20 dark:hover:bg-orange-300/20',
+};
export async function ExploreSection({ title, fetcher }: Props) {
const challenges = await fetcher();
return (
- <section className="py-5">
- <div className="flex items-center justify-between">
- <div className="hidden w-[117px] md:block"></div>
+ <section
+ className={`relative flex w-full flex-col overflow-hidden rounded-[2.5rem] ${
+ COLORS_BY_DIFFICULTY[challenges[0]?.difficulty || 'BEGINNER']
+ }`}
+ >
+ {challenges[0]?.difficulty === 'EASY' && (
+ <>
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 stroke-1 text-green-600/10 duration-300 group-hover:scale-90 dark:text-green-500/10"></Diamond>
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 -translate-x-[5%] translate-y-[255%] stroke-1 text-green-600/10 duration-300 group-hover:scale-90 dark:text-green-500/10"></Diamond>
+
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 -translate-x-[130%] translate-y-[130%] stroke-1 text-green-600/10 duration-300 group-hover:scale-90 dark:text-green-500/10"></Diamond>
+
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 -translate-x-[265%] translate-y-[5%] stroke-1 text-green-600/10 duration-300 group-hover:scale-90 dark:text-green-500/10"></Diamond>
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 -translate-x-[260%] translate-y-[260%] stroke-1 text-green-600/10 duration-300 group-hover:scale-90 dark:text-green-500/10"></Diamond>
+
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 -translate-x-[395%] translate-y-[135%] stroke-1 text-green-600/10 duration-300 group-hover:scale-90 dark:text-green-500/10"></Diamond>
+
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 -translate-x-[525%] translate-y-[265%] stroke-1 text-green-600/10 duration-300 group-hover:scale-90 dark:text-green-500/10"></Diamond>
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 -translate-x-[535%] translate-y-[15%] stroke-1 text-green-600/10 duration-300 group-hover:scale-90 dark:text-green-500/10"></Diamond>
+
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 -translate-x-[665%] translate-y-[145%] stroke-1 text-green-600/10 duration-300 group-hover:scale-90 dark:text-green-500/10"></Diamond>
+
+ <Diamond className="absolute -right-5 -top-10 h-24 w-24 -translate-x-[795%] translate-y-[275%] stroke-1 text-green-600/10 duration-300 group-hover:scale-90 dark:text-green-500/10"></Diamond>
+ </>
+ )}
+
+ <div className="flex items-center justify-between p-5 pb-0 pl-7">
+ {/* <div className="hidden w-[117px] md:block"></div> */}
<h2
- className={`my-4 pl-4 text-xl font-semibold tracking-tight md:pl-0 md:text-2xl lg:my-6 ${
- COLORS_BY_DIFFICULTY[challenges[0]?.difficulty || 'BEGINNER']
+ className={`bg-clip-text text-3xl font-bold tracking-tight text-transparent ${
+ TITLES_BY_DIFFICULTY[challenges[0]?.difficulty || 'BEGINNER']
}`}
>
{title}
</h2>
- <Button variant="ghost" className="group items-center rounded-full px-4 py-2">
+ <Button
+ variant="ghost"
+ className={`group items-center whitespace-nowrap rounded-full py-2 pl-4 pr-3 backdrop-blur-sm
+ ${BUTTONS_BY_DIFFICULTY[challenges[0]?.difficulty || 'BEGINNER']}`}
+ >
view more
- <ChevronRight className="h-4 w-4 duration-300 group-hover:translate-x-2" />
+ <ChevronRight className="ml-2 h-4 w-4 stroke-[3] duration-300 group-hover:translate-x-1" />
</Button>
</div>
- <div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
+ <div className="hide-scrollbar flex w-full snap-x flex-nowrap gap-4 overflow-x-scroll p-5">
{challenges
.sort((a, b) =>
difficultyToNumber[a.difficulty] !== difficultyToNumber[b.difficulty]
@@ -55,7 +102,7 @@ export async function ExploreSection({ title, fetcher }: Props) {
)
.map((challenge) => (
<Link
- className="group focus:outline-none"
+ className="group snap-center focus:outline-none sm:w-[330px] xl:w-[382px]"
href={`/challenge/${challenge.id}`}
key={challenge.id}
>
diff --git a/src/components/landing/community/community.module.css b/src/components/landing/community/community.module.css
index 7a0a5dce..5474dc45 100644
--- a/src/components/landing/community/community.module.css
+++ b/src/components/landing/community/community.module.css
@@ -6,7 +6,7 @@
hsla(var(--background) / 0.95) 33%,
hsl(var(--background)) 50%
),
- url('../../../assets/images/background_pattern_flipped.png');
+ url('../../../assets/images/background_pattern_flipped.webp');
background-size: cover;
background-position-y: bottom;
background-position-x: center;
@@ -41,7 +41,7 @@
hsla(var(--background) / 0.95) 15%,
hsl(var(--background)) 30%
),
- url('../../../assets/images/background_pattern_flipped.png');
+ url('../../../assets/images/background_pattern_flipped.webp');
background-size: 1800px;
background-position-y: bottom;
diff --git a/src/components/landing/waitlist/waitlist.module.css b/src/components/landing/waitlist/waitlist.module.css
index 6f208741..58412707 100644
--- a/src/components/landing/waitlist/waitlist.module.css
+++ b/src/components/landing/waitlist/waitlist.module.css
@@ -17,7 +17,7 @@
}
.mybg {
- background: url('../../../assets/images/waitlist-bg.png');
+ background: url('../../../assets/images/waitlist-bg.webp');
background-position-y: 33%;
background-position-x: center;
background-repeat: no-repeat;
@@ -39,7 +39,7 @@
rgba(59, 131, 199, 0.17) 75.5%,
rgba(49, 120, 198, 0.3) 100%
),
- url('../../../assets/images/background_pattern.png');
+ url('../../../assets/images/background_pattern.webp');
background-size: cover;
background-position-x: center;
background-repeat: no-repeat;
diff --git a/src/components/wizard/ChallengeCardEditor.tsx b/src/components/wizard/ChallengeCardEditor.tsx
index d243dc87..4c8b2faa 100644
--- a/src/components/wizard/ChallengeCardEditor.tsx
+++ b/src/components/wizard/ChallengeCardEditor.tsx
@@ -38,32 +38,45 @@ export function ChallengeCardEditor({ form }: Props) {
updatedAt: new Date(),
};
return (
- <div className="h-full py-6">
- <TypographyH3 className="mb-6">Create Challenge Card</TypographyH3>
- <div className="flex items-start gap-12">
- <div className="flex w-1/3 flex-col gap-3">
+ <>
+ <TypographyH3 className="mx-auto mb-4 max-w-fit lg:mb-6">Create Challenge Card</TypographyH3>
+ <div className="flex flex-wrap items-start justify-center gap-4 xl:px-24">
+ <div className="w-full sm:w-2/3 lg:w-[333px] xl:w-[392px]">
+ <ExploreCard challenge={data} />
+ </div>
+ <div className="flex w-full flex-col gap-1 rounded-3xl border border-neutral-200 bg-neutral-100 p-4 pt-[0.8rem] dark:border-neutral-800 dark:bg-neutral-900 sm:w-2/3 lg:w-[calc(333px+79px+16px)] xl:w-[calc(392px+79px+16px)]">
<FormField
control={form.control}
name="difficulty"
render={({ field }) => {
return (
<FormItem>
- <FormLabel>Email</FormLabel>
+ <FormLabel className="mt-2">Difficulty: </FormLabel>
<Select
onValueChange={field.onChange as (value: string) => void}
defaultValue={field.value}
>
<FormControl>
- <SelectTrigger>
+ <SelectTrigger className="rounded-xl bg-neutral-200 dark:bg-neutral-800">
<SelectValue placeholder="Select a difficulty for your challenge" />
</SelectTrigger>
</FormControl>
- <SelectContent>
- <SelectItem value="BEGINNER">BEGINNER</SelectItem>
- <SelectItem value="EASY">EASY</SelectItem>
- <SelectItem value="MEDIUM">MEDIUM</SelectItem>
- <SelectItem value="HARD">HARD</SelectItem>
- <SelectItem value="EXTREME">EXTREME</SelectItem>
+ <SelectContent className="rounded-xl border border-neutral-300 bg-neutral-200 shadow-[0_0_2rem_#0008] dark:border-neutral-700 dark:bg-neutral-800">
+ <SelectItem className="rounded-t-lg brightness-150" value="BEGINNER">
+ BEGINNER
+ </SelectItem>
+ <SelectItem className="brightness-150" value="EASY">
+ EASY
+ </SelectItem>
+ <SelectItem className="brightness-150" value="MEDIUM">
+ MEDIUM
+ </SelectItem>
+ <SelectItem className="brightness-150" value="HARD">
+ HARD
+ </SelectItem>
+ <SelectItem className="rounded-b-lg brightness-150" value="EXTREME">
+ EXTREME
+ </SelectItem>
</SelectContent>
</Select>
<FormMessage />
@@ -76,9 +89,13 @@ export function ChallengeCardEditor({ form }: Props) {
name="name"
render={({ field }) => (
<FormItem>
- <FormLabel>Challenge Title</FormLabel>
+ <FormLabel>Challenge Title:</FormLabel>
<FormControl>
- <Input placeholder="Enter a Challenge Title" {...field} />
+ <Input
+ className="rounded-xl bg-neutral-200 dark:bg-neutral-800"
+ placeholder="Enter a Challenge Title"
+ {...field}
+ />
</FormControl>
<FormMessage />
</FormItem>
@@ -89,11 +106,11 @@ export function ChallengeCardEditor({ form }: Props) {
name="shortDescription"
render={({ field }) => (
<FormItem>
- <FormLabel>Short Description</FormLabel>
+ <FormLabel>Short Description:</FormLabel>
<FormControl>
<Textarea
placeholder="Enter a Short Description"
- className="resize-none"
+ className="resize-none rounded-xl bg-neutral-200 dark:bg-neutral-800"
{...field}
/>
</FormControl>
@@ -102,10 +119,7 @@ export function ChallengeCardEditor({ form }: Props) {
)}
/>
</div>
- <div className="w-[392px]">
- <ExploreCard challenge={data} />
- </div>
</div>
- </div>
+ </>
);
}
diff --git a/src/components/wizard/DescriptionEditor.tsx b/src/components/wizard/DescriptionEditor.tsx
index a606417a..00cd6dc0 100644
--- a/src/components/wizard/DescriptionEditor.tsx
+++ b/src/components/wizard/DescriptionEditor.tsx
@@ -14,10 +14,10 @@ interface Props {
export function DescriptionEditor({ form }: Props) {
const description = useWatch({ control: form.control, name: 'description' });
return (
- <div className="flex h-full flex-col py-6">
- <TypographyH3 className="mb-6">Create Challenge Description</TypographyH3>
- <div className="flex flex-1 gap-6">
- <div className="flex w-[500px] flex-col gap-3">
+ <div className="flex h-full flex-1 flex-col">
+ <TypographyH3 className="mx-auto mb-4 lg:mb-6">Create Challenge Description</TypographyH3>
+ <div className="flex flex-1 flex-wrap gap-2 md:flex-nowrap">
+ <div className="flex w-full flex-col gap-2 overflow-hidden rounded-l-2xl rounded-r-2xl border border-zinc-300 dark:border-zinc-700 md:w-[500px] md:rounded-r-xl">
<FormField
control={form.control}
name="description"
@@ -35,7 +35,7 @@ export function DescriptionEditor({ form }: Props) {
}}
/>
</div>
- <div className="h-full w-full rounded-md border border-zinc-300 bg-white p-3 dark:border-zinc-700 dark:bg-zinc-800">
+ <div className="w-full rounded-l-2xl rounded-r-2xl border border-zinc-300 bg-white p-3 dark:border-zinc-700 dark:bg-zinc-800 md:h-full md:rounded-l-xl">
<Markdown>{description}</Markdown>
</div>
</div>
diff --git a/src/components/wizard/NextBack.tsx b/src/components/wizard/NextBack.tsx
new file mode 100644
index 00000000..c099a0a7
--- /dev/null
+++ b/src/components/wizard/NextBack.tsx
@@ -0,0 +1,42 @@
+import { STEPS, type Step } from '.';
+import { Button } from '../ui/button';
+
+interface Props<T extends Step> {
+ current: number;
+ onChange: (index: number) => void;
+ onNext: () => void;
+ onSubmit: () => Promise<void>;
+}
+
+export function NextBack<T extends Step>({ current, onChange, onNext, onSubmit }: Props<T>) {
+ return (
+ <div className={`flex justify-center gap-3 ${current === STEPS.Summary && ''}`}>
+ <>
+ {current > STEPS.ChallengeCard && (
+ <Button
+ className="rounded-full bg-neutral-200 duration-300 active:scale-95 dark:bg-neutral-800 dark:hover:bg-neutral-700"
+ variant="ghost"
+ onClick={() => onChange(current - 1)}
+ >
+ Back
+ </Button>
+ )}
+ {current === STEPS.Summary ? (
+ <Button
+ className="w-[79px] rounded-full bg-emerald-500 transition-all duration-300 ease-out hover:bg-emerald-400 hover:px-16 active:scale-95"
+ onClick={onSubmit}
+ >
+ Submit
+ </Button>
+ ) : (
+ <Button
+ onClick={onNext}
+ className="w-[79px] rounded-full transition-all duration-300 ease-out hover:pl-8 active:scale-95"
+ >
+ Next
+ </Button>
+ )}
+ </>
+ </div>
+ );
+}
diff --git a/src/components/wizard/Steps.tsx b/src/components/wizard/Steps.tsx
index dc41cd34..f55e3a5e 100644
--- a/src/components/wizard/Steps.tsx
+++ b/src/components/wizard/Steps.tsx
@@ -1,99 +1,64 @@
import { Check } from 'lucide-react';
-import { STEPS, type Step } from '.';
-import { Button } from '../ui/button';
+import { type Step } from '.';
interface Props<T extends Step> {
current: number;
steps: T[];
onChange: (index: number) => void;
- onNext: () => void;
- onSubmit: () => Promise<void>;
}
-export function Steps<T extends Step>({ steps, current, onChange, onNext, onSubmit }: Props<T>) {
+export function Steps<T extends Step>({ steps, current, onChange }: Props<T>) {
return (
- <nav className="items-center justify-between md:flex" aria-label="Progress">
+ <nav className="flex justify-center px-4 lg:-mt-[56px]" aria-label="Progress">
<ol
role="list"
- className="mb-3 divide-y rounded-xl border border-zinc-300 dark:border-zinc-700 md:flex md:w-10/12 md:divide-y-0"
+ className="flex w-full flex-wrap items-start justify-start gap-2 divide-y sm:justify-center md:w-10/12 md:divide-y-0"
>
{steps.map((step, stepIdx) => (
- <li key={step.name} className="relative md:flex md:flex-1">
+ <li
+ key={step.name}
+ className={`relative rounded-full ${
+ current > stepIdx ? 'bg-emerald-500/20' : 'bg-gray-500/10'
+ } py-1 pl-[0.4rem] pr-3 md:flex`}
+ >
{current > stepIdx ? (
<a
href={'#'}
className="group flex w-full items-center"
onClick={() => onChange(stepIdx)}
>
- <span className="flex items-center px-6 py-4 text-sm font-medium">
- <span className="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-green-300 text-white dark:bg-green-800">
- <Check className="stroke-black dark:stroke-white" size={20} />
+ <span className="flex items-center gap-2 text-sm font-medium">
+ <span className="flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full bg-emerald-700 text-white dark:bg-emerald-400">
+ <Check
+ className="h-3 w-3 stroke-white stroke-[3] dark:stroke-black"
+ size={20}
+ />
+ </span>
+ <span className="text-sm font-medium text-emerald-700 dark:text-emerald-500">
+ {step.name}
</span>
- <span className="ml-4 text-sm font-medium">{step.name}</span>
</span>
</a>
) : current === stepIdx ? (
- <span className="flex items-center px-6 py-4 text-sm font-medium" aria-current="step">
- <span className="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full border-2 border-zinc-300 dark:border-zinc-700">
- <span>{step.id}</span>
+ <span className="flex items-center gap-2 text-sm font-medium" aria-current="step">
+ <span className="flex h-5 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gray-500/30 p-2 dark:bg-gray-500/50">
+ <span className="text-xs">{step.id}</span>
</span>
- <span className="ml-4 text-sm font-medium">{step.name}</span>
+ <span className="text-sm font-medium">{step.name}</span>
</span>
) : (
<span className="group flex items-center">
- <span className="flex items-center px-6 py-4 text-sm font-medium">
- <span className="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full border-2">
- <span className="text-gray-500">{step.id}</span>
+ <span className="flex items-center gap-2 text-sm font-medium">
+ <span className="flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full">
+ <span className="text-xs text-gray-500">{step.id}</span>
</span>
- <span className="ml-4 text-sm font-medium text-gray-500 ">{step.name}</span>
+ <span className="text-sm font-medium text-gray-500 ">{step.name}</span>
</span>
</span>
)}
-
- {stepIdx !== steps.length - 1 ? (
- <>
- {/* Arrow separator for lg screens and up */}
- <div
- className="absolute right-0 top-0 hidden h-full w-5 md:block"
- aria-hidden="true"
- >
- <svg
- className="h-full w-full text-zinc-300 dark:text-zinc-700"
- viewBox="0 0 22 80"
- fill="none"
- preserveAspectRatio="none"
- >
- <path
- d="M0 -2L20 40L0 82"
- vectorEffect="non-scaling-stroke"
- stroke="currentcolor"
- strokeLinejoin="round"
- />
- </svg>
- </div>
- </>
- ) : null}
</li>
))}
</ol>
- <div className="flex justify-end gap-3">
- <>
- {current > STEPS.ChallengeCard && (
- <Button variant="ghost" onClick={() => onChange(current - 1)}>
- Back
- </Button>
- )}
- {current === STEPS.Summary ? (
- <Button className="w-[79px]" onClick={onSubmit}>
- Submit
- </Button>
- ) : (
- <Button onClick={onNext} className="w-[79px]">
- Next
- </Button>
- )}
- </>
- </div>
</nav>
);
}
diff --git a/src/components/wizard/Summary.tsx b/src/components/wizard/Summary.tsx
index d42c58fb..0be84d2e 100644
--- a/src/components/wizard/Summary.tsx
+++ b/src/components/wizard/Summary.tsx
@@ -3,12 +3,18 @@ interface Props {
}
export function Summary({ isUserACreator }: Props) {
return (
- <div className="flex h-full flex-col items-center justify-center">
- <div className="mb-5 text-center text-5xl font-bold text-gray-900 dark:text-gray-100">
+ <div className="flex flex-col items-center justify-center pb-8 pt-12">
+ <div className="mb-3 max-w-[20ch] text-center text-3xl font-bold text-gray-900 dark:text-gray-100 md:text-5xl">
{isUserACreator ? (
- <>Thanks for creating a challenge! Submit it to share with the community.</>
+ <>
+ πŸŽ‰ <br />
+ <br /> Thanks for creating a challenge! Submit it to share with the community.
+ </>
) : (
- <>Thanks for creating a challenge! Submit it to the community for review.</>
+ <>
+ πŸŽ‰ <br /> <br />
+ Thanks for creating a challenge! Submit it to the community for review.
+ </>
)}
</div>
</div>
diff --git a/src/components/wizard/TestCasesEditor.tsx b/src/components/wizard/TestCasesEditor.tsx
index b2f2908b..13d52cab 100644
--- a/src/components/wizard/TestCasesEditor.tsx
+++ b/src/components/wizard/TestCasesEditor.tsx
@@ -69,15 +69,15 @@ export function TestCasesEditor({ form, hasTsErrors, setTsErrors }: Props) {
);
return (
- <div className="flex h-full flex-col py-6">
- <TypographyH3 className="mb-6">Create Test Cases</TypographyH3>
+ <div className="flex h-full flex-1 flex-col">
+ <TypographyH3 className="mx-auto mb-4 lg:mb-6">Create Test Cases</TypographyH3>
<FormField
control={form.control}
name="prompt"
render={({ field }) => {
return (
<FormItem className="h-full">
- <div className="flex h-full flex-col">
+ <div className="flex h-full flex-col overflow-hidden rounded-2xl border border-zinc-300 dark:border-zinc-700">
<div className="sticky top-0 flex h-[40px] flex-row-reverse items-center border-b border-zinc-300 px-3 py-2 dark:border-zinc-700 dark:bg-[#1e1e1e]">
<Dialog>
<DialogTrigger>
diff --git a/src/components/wizard/index.tsx b/src/components/wizard/index.tsx
index 90070e7c..2c1205d3 100644
--- a/src/components/wizard/index.tsx
+++ b/src/components/wizard/index.tsx
@@ -10,6 +10,7 @@ import { USER_CODE_START, USER_CODE_START_REGEX } from '../challenge/code-panel/
import { ChallengeCardEditor } from './ChallengeCardEditor';
import { DescriptionEditor } from './DescriptionEditor';
import { Steps } from './Steps';
+import { NextBack } from './NextBack';
import { Summary } from './Summary';
import { TestCasesEditor } from './TestCasesEditor';
import { uploadChallenge } from './create.action';
@@ -115,34 +116,36 @@ export function Wizard() {
if (isUserACreator) {
router.push(`/challenge/${id}`);
} else {
- router.push(`/explore}`);
+ router.push(`/explore`);
}
}
return (
- <div className="container h-full pb-6">
- <div className="flex h-full flex-col">
- {/* we cant nest this in the form because it causes the editor to resize inifinitely hence the onSubmit(wtf..) */}
- <Steps
- steps={steps}
- current={step}
- onChange={(idx) => setStep(idx)}
- onNext={handleNextClick}
- onSubmit={form.handleSubmit(onSubmit)}
- />
- {rendered && (
- <Form {...form}>
- <form className="flex-1">
- {step === STEPS.ChallengeCard && <ChallengeCardEditor form={form} />}
- {step === STEPS.Description && <DescriptionEditor form={form} />}
- {step === STEPS.TestCases && (
- <TestCasesEditor form={form} hasTsErrors={hasTsErrors} setTsErrors={setTsErrors} />
- )}
- {step === 3 && <Summary isUserACreator={isUserACreator} />}
- </form>
- </Form>
- )}
- </div>
+ <div className="flex h-full flex-col gap-4 pb-4 pt-4 lg:gap-6 lg:pb-8">
+ {/* we cant nest this in the form because it causes the editor to resize inifinitely hence the onSubmit(wtf..) */}
+ <Steps steps={steps} current={step} onChange={(idx) => setStep(idx)} />
+ {rendered && (
+ <Form {...form}>
+ <form
+ className={`container ${
+ (step === STEPS.Description || step === STEPS.TestCases) && 'h-full'
+ }`}
+ >
+ {step === STEPS.ChallengeCard && <ChallengeCardEditor form={form} />}
+ {step === STEPS.Description && <DescriptionEditor form={form} />}
+ {step === STEPS.TestCases && (
+ <TestCasesEditor form={form} hasTsErrors={hasTsErrors} setTsErrors={setTsErrors} />
+ )}
+ {step === 3 && <Summary isUserACreator={isUserACreator} />}
+ </form>
+ </Form>
+ )}
+ <NextBack
+ current={step}
+ onChange={(idx) => setStep(idx)}
+ onNext={handleNextClick}
+ onSubmit={form.handleSubmit(onSubmit)}
+ />
</div>
);
}
diff --git a/src/styles/globals.css b/src/styles/globals.css
index 8eaf6679..759432e7 100644
--- a/src/styles/globals.css
+++ b/src/styles/globals.css
@@ -332,3 +332,8 @@ main {
opacity: 0.1;
-webkit-mask-image: radial-gradient(140px 50% at 50% 100%, black, transparent);
}
+
+.hide-scrollbar::-webkit-scrollbar {
+ display: none; /* Chrome Safari */
+ scrollbar-width: none; /* Firefox */
+}