Skip to content

Commit

Permalink
Relates #27
Browse files Browse the repository at this point in the history
Closes #25
Relates #17
Relates #9
  • Loading branch information
JasonWarrenUK committed Oct 1, 2024
1 parent ebe916e commit 666f99b
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 16 deletions.
4 changes: 0 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ import './App.css';
import Header from './sections/Header';
import Content from './sections/Content';
import Footer from './sections/Footer';
import Button from './buttons/Button';

function App() {
return (
<>
<Header />
<Content />
<Button onClick={function (): void {
throw new Error('Function not implemented.')
} } label={'Click me'} />
<Footer />
</>
);
Expand Down
14 changes: 12 additions & 2 deletions src/forms/NameForm.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import React from 'react';
import Button from '../buttons/Button';
import NameInput from '../inputs/NameInput';

function NameForm() {
interface NameFormProps {
onSubmit: () => void;
}

function NameForm({ onSubmit }: NameFormProps) {
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
onSubmit();
};

return (
<form>
<form onSubmit={handleSubmit}>
<NameInput />
<Button
onClick={() => {
Expand Down
17 changes: 17 additions & 0 deletions src/pages/Dummy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Button from "../buttons/Button";

interface DummyProps {
onNext: () => void;
}

function Dummy({ onNext }: DummyProps) {
return (
// render background image that fills the whole component
<div>
<p>lol no</p>
<Button onClick={onNext} label="Back to Landing" />
</div>
)
}

export default Dummy;
10 changes: 7 additions & 3 deletions src/pages/Landing.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import FormName from '../forms/NameForm';
import NameForm from '../forms/NameForm';
import LandingText from '../text/LandingText';

function Landing() {
interface LandingProps {
onNext: () => void;
}

function Landing({ onNext }: LandingProps) {
return (
// render background image that fills the whole component
<>
<LandingText />
<FormName />
<NameForm onSubmit={onNext} />
</>
)
}
Expand Down
35 changes: 28 additions & 7 deletions src/sections/Content.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
import { useState } from 'react';
import Landing from '../pages/Landing';
/* import Input from '../pages/Input'; */
/* import Loading from '../pages/Loading'; */
/* import Playlist from '../pages/Playlist'; */
// import Input from '../pages/Input';
// import Loading from '../pages/Loading';
// import Playlist from '../pages/Playlist';
import Dummy from '../pages/Dummy';

function Content() {
return (
<main>
<Landing />
const [currentPage, setCurrentPage] = useState('landing');

const renderPage = () => {
switch (currentPage) {
case 'dummy':
return <Dummy onNext={() => setCurrentPage('landing')} />;
case 'landing':
return <Landing onNext={() => setCurrentPage('dummy')} />;
// case 'input':
// return <Input onNext={() => setCurrentPage('loading')} />;
// case 'loading':
// return <Loading onNext={() => setCurrentPage('playlist')} />;
// case 'playlist':
// return <Playlist />;
default:
return <Dummy onNext={() => setCurrentPage('Landing')} />;
}
};

return (
<main>
{renderPage()}
</main>
)
)
}

export default Content;

0 comments on commit 666f99b

Please sign in to comment.