Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>frontend</title>
<title>CodeSCE</title>
</head>
<body>
<div id="root"></div>
Expand Down
42 changes: 27 additions & 15 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

119 changes: 92 additions & 27 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,107 @@
#root {
max-width: 1280px;
.app-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 1rem;
}

.start-card {
width: 100%;
max-width: 360px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
.assessment-page {
width: 100%;
max-width: none;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);

.assessment-container {
align-items: stretch;
justify-content: flex-start;
padding: 0;
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);

.assessment-layout {
display: grid;
grid-template-columns: 1fr 2fr;
gap: 0;
margin: 0.75rem 0;
min-height: calc(100vh - 6rem);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
.question-section {
border-right: 1px solid #c7c7c7;
padding: 0.75rem;
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
.right-section {
display: flex;
flex-direction: column;
}

.answer-section {
padding: 0.75rem;
}

.results-section {
border-top: 1px solid #c7c7c7;
padding: 0.75rem;
}

.results-section h2 {
margin-top: 0;
}

.answer-section textarea {
width: 100%;
min-height: 220px;
resize: vertical;
}

.card {
padding: 2em;
.start-card h1 {
margin-top: 0;
}

.read-the-docs {
color: #888;
.form-row {
display: flex;
gap: 0.5rem;
justify-content: center;
}

.form-row input {
flex: 1;
padding: 0.35rem 0.5rem;
}

.form-row button {
padding: 0.35rem 0.75rem;
}

.message {
margin: 0.5rem 0 0;
}

.error {
color: #b00020;
}

@media (max-width: 480px) {
.form-row {
flex-direction: column;
}
}

@media (max-width: 800px) {
.assessment-layout {
grid-template-columns: 1fr;
min-height: auto;
}

.question-section {
border-right: 0;
border-bottom: 1px solid #c7c7c7;
}
}
61 changes: 35 additions & 26 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import Assessment from './Assessment'
import Home from './Home'

function App() {
const [count, setCount] = useState(0)
const [page, setPage] = useState<'home' | 'assessment'>('home')
const [name, setName] = useState('')
const [solution, setSolution] = useState('')
const [error, setError] = useState('')

const handleStart = () => {
const trimmedName = name.trim()

if (!trimmedName) {
setError('Enter name')
return
}

setError('')
console.log(trimmedName)
setPage('assessment')
}

if (page === 'assessment') {
return (
<Assessment
solution={solution}
onSolutionChange={setSolution}
onBack={() => setPage('home')}
/>
)
}

return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
<Home
name={name}
error={error}
onNameChange={setName}
onStart={handleStart}
/>
)
}

Expand Down
Loading