Initial commit.
This commit is contained in:
40
src/pages/games/[id]/index.tsx
Normal file
40
src/pages/games/[id]/index.tsx
Normal file
@ -0,0 +1,40 @@
|
||||
import { GetServerSideProps, GetStaticPaths, GetStaticProps } from 'next';
|
||||
import Link from 'next/link';
|
||||
|
||||
type PageParams = {
|
||||
id:string;
|
||||
}
|
||||
|
||||
type PageProps = {
|
||||
id:string;
|
||||
}
|
||||
|
||||
export const getServerSideProps:GetServerSideProps<> = async ({ params }) => {
|
||||
const { id } = params as PageParams;
|
||||
|
||||
// if(id !== '0') {
|
||||
// return {
|
||||
// notFound: true
|
||||
// };
|
||||
// }
|
||||
|
||||
return {
|
||||
props: {
|
||||
id
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const Page:React.FC<PageProps> = ({ id }) => {
|
||||
return (
|
||||
<div>
|
||||
<h1>Viewing Game ID: {id}</h1>
|
||||
|
||||
<Link href={`/games/${id}/play`}>
|
||||
Play Game
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
6
src/pages/games/[id]/play.module.scss
Normal file
6
src/pages/games/[id]/play.module.scss
Normal file
@ -0,0 +1,6 @@
|
||||
.play {
|
||||
&__emulator {
|
||||
max-width: 320px;
|
||||
margin: auto;
|
||||
}
|
||||
}
|
35
src/pages/games/[id]/play.tsx
Normal file
35
src/pages/games/[id]/play.tsx
Normal file
@ -0,0 +1,35 @@
|
||||
import { GetServerSideProps } from 'next';
|
||||
import { Emulator } from '@/components/Emulator';
|
||||
import styles from './play.module.scss';
|
||||
|
||||
type PageParams = {
|
||||
id:string;
|
||||
}
|
||||
|
||||
type PageProps = {
|
||||
id:string;
|
||||
}
|
||||
|
||||
export const getServerSideProps:GetServerSideProps = async ({ params }) => {
|
||||
const { id } = params as PageParams;
|
||||
|
||||
return {
|
||||
props: {
|
||||
id
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const Page:React.FC<PageProps> = ({ id }) => {
|
||||
return (
|
||||
<div className={styles.play}>
|
||||
<h1>Playing Game ID: {id}</h1>
|
||||
|
||||
<div className={styles.play__emulator}>
|
||||
<Emulator system='gbc' />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
Reference in New Issue
Block a user