Browse Source

chore: move Container to index and relieve each page of the responsibility

master
Muthu Kumar 1 month ago
parent
commit
08ee02d40a
Failed to extract signature
  1. 9
      src/index.tsx
  2. 7
      src/pages/main/Contact.tsx
  3. 5
      src/pages/main/Exp.tsx
  4. 11
      src/pages/main/Home.tsx
  5. 5
      src/pages/main/Work.tsx

9
src/index.tsx

@ -3,6 +3,7 @@ import { createRoot } from "react-dom/client";
import useLocation from "wouter/use-location"; import useLocation from "wouter/use-location";
import { normalise } from "./util"; import { normalise } from "./util";
import Container from "./components/Container";
const Home = lazy(() => import("./pages/main/Home")); const Home = lazy(() => import("./pages/main/Home"));
const Exp = lazy(() => import("./pages/main/Exp")); const Exp = lazy(() => import("./pages/main/Exp"));
@ -34,8 +35,10 @@ function App() {
createRoot(document.getElementById("root")!).render( createRoot(document.getElementById("root")!).render(
<React.StrictMode> <React.StrictMode>
<Suspense> <Container>
<App /> <Suspense>
</Suspense> <App />
</Suspense>
</Container>
</React.StrictMode>, </React.StrictMode>,
); );

7
src/pages/main/Contact.tsx

@ -1,7 +1,6 @@
import React from "react"; import React from "react";
import { css } from "@emotion/css"; import { css } from "@emotion/css";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import Container from "../../components/Container";
import { setupCursorTracking } from "../../util/index.ts"; import { setupCursorTracking } from "../../util/index.ts";
import { ReactComponent as Logo } from "../../assets/logo.svg"; import { ReactComponent as Logo } from "../../assets/logo.svg";
import { Flippable } from "../../components/Flippable.tsx"; import { Flippable } from "../../components/Flippable.tsx";
@ -96,11 +95,11 @@ const Contact: React.FC = () => {
}, []); }, []);
return ( return (
<Container> <>
<h1>MKRhere</h1> <h1>MKRhere</h1>
{visible < 1 && ( {visible < 1 && (
<AnimateEntry as="article" delay={500}> <AnimateEntry as="article" delay={500}>
<p>Great, You've distributed all the cards!</p> <p>Great. You've distributed all the cards!</p>
<p>What now?</p> <p>What now?</p>
<br /> <br />
<a href="/">Start over?</a> <a href="/">Start over?</a>
@ -246,7 +245,7 @@ const Contact: React.FC = () => {
</Draggable> </Draggable>
))} ))}
</AnimateEntry> </AnimateEntry>
</Container> </>
); );
}; };

5
src/pages/main/Exp.tsx

@ -1,6 +1,5 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { css, cx } from "@emotion/css"; import { css, cx } from "@emotion/css";
import Container from "../../components/Container";
import { ExpUnit } from "../../components/Exp/Unit"; import { ExpUnit } from "../../components/Exp/Unit";
import { age, experience } from "./data/experience"; import { age, experience } from "./data/experience";
import { offscreenWidth } from "../../components/constants"; import { offscreenWidth } from "../../components/constants";
@ -36,7 +35,7 @@ const Exp: React.FC = () => {
}, []); }, []);
return ( return (
<Container> <>
<h2> <h2>
Im a {age} year old developer from Im a {age} year old developer from
<br /> <br />
@ -94,7 +93,7 @@ const Exp: React.FC = () => {
/> />
))} ))}
</div> </div>
</Container> </>
); );
}; };

11
src/pages/main/Home.tsx

@ -1,16 +1,21 @@
import React from "react"; import React from "react";
import Container from "../../components/Container";
import FlickerList, { Tooltip } from "../../components/FlickerList"; import FlickerList, { Tooltip } from "../../components/FlickerList";
import { ReactComponent as Arrow } from "../../assets/arrow-thin.svg"; import { ReactComponent as Arrow } from "../../assets/arrow-thin.svg";
import { css } from "@emotion/css"; import { css } from "@emotion/css";
import { setupCursorTracking } from "../../util"; import { setupCursorTracking } from "../../util";
import { Emoji } from "../../components/Emoji"; import { Emoji } from "../../components/Emoji";
import { AnimateEntry } from "../../components/AnimateEntry";
const Home: React.FC = () => { const Home: React.FC = () => {
return ( return (
<Container <AnimateEntry
as="main"
delay={200}
className={css` className={css`
--gap: 2.2rem; --gap: 2.2rem;
display: flex;
flex-direction: column;
gap: var(--gap);
`}> `}>
<section> <section>
<h1 <h1
@ -155,7 +160,7 @@ const Home: React.FC = () => {
</button> </button>
</article> </article>
</main> </main>
</Container> </AnimateEntry>
); );
}; };

5
src/pages/main/Work.tsx

@ -1,6 +1,5 @@
import React from "react"; import React from "react";
import { css, cx } from "@emotion/css"; import { css, cx } from "@emotion/css";
import Container from "../../components/Container";
import { otherProjects, projects, type Project } from "./data/project"; import { otherProjects, projects, type Project } from "./data/project";
const styles = { const styles = {
@ -138,7 +137,7 @@ const otherProjectsStyle = css`
const Exp: React.FC = () => { const Exp: React.FC = () => {
return ( return (
<Container> <>
<h2>Things I've built</h2> <h2>Things I've built</h2>
<p>A few projects I'm proud of:</p> <p>A few projects I'm proud of:</p>
<div <div
@ -203,7 +202,7 @@ const Exp: React.FC = () => {
))} ))}
</tbody> </tbody>
</table> </table>
</Container> </>
); );
}; };

Loading…
Cancel
Save