33import Link from "next/link" ;
44import Editor from "@/components/Editor/Editor" ;
55import React , { useState } from "react" ;
6+ import Button from "@/components/ui/Button" ;
7+ import TabButton from "@/components/ui/TabButton" ;
8+ import Modal from "@/components/Modal/Modal" ;
9+ import QuestionWindow from "@/components/ui/QuestionWindow" ;
610
711function Section ( { id, children } : { id : string ; children ?: React . ReactNode } ) {
812 return (
@@ -18,6 +22,9 @@ function Section({ id, children }: { id: string; children?: React.ReactNode }) {
1822}
1923export default function UIPage ( ) {
2024 const [ selectedLanguage , setSelectedLanguage ] = useState ( "C++" ) ;
25+ const [ showModal , setShowModal ] = useState <
26+ "default" | "green" | "red" | "yellow" | null
27+ > ( null ) ;
2128 const languages = [
2229 "C++" ,
2330 "C" ,
@@ -29,6 +36,28 @@ export default function UIPage() {
2936 "Racket" ,
3037 "Ruby" ,
3138 ] ;
39+ const questions = [
40+ {
41+ id : 1 ,
42+ title : "PROBLEM 1: HELLO WORLD" ,
43+ points : 10 ,
44+ content : [
45+ "A queue is an abstract data type that maintains order..." ,
46+ "A basic queue has the following operations:" ,
47+ "Enqueue: add to the end." ,
48+ "Dequeue: remove from the front." ,
49+ ] ,
50+ } ,
51+ {
52+ id : 2 ,
53+ title : "PROBLEM 2: STACK IMPLEMENTATION" ,
54+ points : 15 ,
55+ content : [
56+ "A stack is a Last-In-First-Out (LIFO) data structure..." ,
57+ "Operations: Push, Pop, Peek." ,
58+ ] ,
59+ } ,
60+ ] ;
3261
3362 return (
3463 < div className = "p-4" >
@@ -117,8 +146,31 @@ export default function UIPage() {
117146 </ Section >
118147
119148 < Section id = "Buttons" >
120- < button className = "button" > Click Me</ button >
121- < button className = "btn-green" > Green Button</ button >
149+ < Button > Default</ Button >
150+ < Button variant = "destructive" > Destructive</ Button >
151+ < Button variant = "outline" > Outline</ Button >
152+ < Button variant = "secondary" > Secondary</ Button >
153+ < Button variant = "ghost" > Ghost</ Button >
154+ < Button variant = "link" > Link</ Button >
155+ < Button variant = "green" > Green Button</ Button >
156+ </ Section >
157+
158+ < Section id = "Tab Buttons" >
159+ < TabButton
160+ id = { 1 }
161+ active = { selectedLanguage === "C++" }
162+ onClick = { ( ) => setSelectedLanguage ( "C++" ) }
163+ />
164+ < TabButton
165+ id = { 2 }
166+ active = { selectedLanguage === "Python3" }
167+ onClick = { ( ) => setSelectedLanguage ( "Python3" ) }
168+ />
169+ < TabButton
170+ id = { 3 }
171+ active = { selectedLanguage === "Java" }
172+ onClick = { ( ) => setSelectedLanguage ( "Java" ) }
173+ />
122174 </ Section >
123175
124176 < Section id = "Editor" >
@@ -130,6 +182,55 @@ export default function UIPage() {
130182 timer = "69:69:69"
131183 />
132184 </ Section >
185+
186+ < Section id = "Question Window" >
187+ < QuestionWindow questions = { questions } />
188+ </ Section >
189+
190+ < Section id = "Modal" >
191+ { ( [ "default" , "green" , "destructive" , "secondary" ] as const ) . map (
192+ ( variant ) => {
193+ const modalVariant : "default" | "green" | "red" | "yellow" =
194+ variant === "destructive"
195+ ? "red"
196+ : variant === "secondary"
197+ ? "yellow"
198+ : variant ;
199+ const buttonVariant :
200+ | "green"
201+ | "secondary"
202+ | "destructive"
203+ | "link"
204+ | "outline"
205+ | "ghost"
206+ | "run" = variant === "default" ? "outline" : variant ;
207+ const displayName =
208+ modalVariant . charAt ( 0 ) . toUpperCase ( ) + modalVariant . slice ( 1 ) ;
209+ return (
210+ < div key = { variant } className = "mb-6" >
211+ < div className = "flex gap-2 mb-2" >
212+ < Button
213+ variant = { buttonVariant }
214+ onClick = { ( ) => setShowModal ( modalVariant ) }
215+ >
216+ Show { displayName } Modal
217+ </ Button >
218+ </ div >
219+ { showModal === modalVariant && (
220+ < Modal
221+ title = { `Sample ${ displayName } Modal` }
222+ message = { `This is a demonstration of the ${ modalVariant } Modal variant. You can customize the title, message, and variant.` }
223+ variant = { modalVariant }
224+ onClose = { ( ) => setShowModal ( null ) }
225+ >
226+ < Button variant = { buttonVariant } > Nested Button</ Button >
227+ </ Modal >
228+ ) }
229+ </ div >
230+ ) ;
231+ }
232+ ) }
233+ </ Section >
133234 </ div >
134235 ) ;
135236}
0 commit comments