Browse Source

feat: use AnimateEntry more

master
Muthu Kumar 1 month ago
parent
commit
65d51f5110
Failed to extract signature
  1. 24
      src/pages/main/Exp.tsx
  2. 10
      src/pages/main/Work.tsx

24
src/pages/main/Exp.tsx

@ -1,4 +1,4 @@
import React, { useEffect } from "react"; import React, { useEffect, useState } from "react";
import { css, cx } from "@emotion/css"; import { css, cx } from "@emotion/css";
import { ExpUnit } from "../../components/Exp/Unit"; import { ExpUnit } from "../../components/Exp/Unit";
import { age, experience } from "./data/experience"; import { age, experience } from "./data/experience";
@ -6,6 +6,7 @@ import { offscreenWidth } from "../../components/constants";
import { Tags } from "../../components/Exp/Tags"; import { Tags } from "../../components/Exp/Tags";
import useSearchParams from "../../util/useSearchParams"; import useSearchParams from "../../util/useSearchParams";
import useLocation from "wouter/use-location"; import useLocation from "wouter/use-location";
import { AnimateEntry } from "../../components/AnimateEntry";
const exp_route = /^\/experience\/?[^\/]*$/; const exp_route = /^\/experience\/?[^\/]*$/;
const slug_replace = /^\/experience\/?/; const slug_replace = /^\/experience\/?/;
@ -13,6 +14,11 @@ const slug_replace = /^\/experience\/?/;
const Exp: React.FC = () => { const Exp: React.FC = () => {
const [location, navigate] = useLocation(); const [location, navigate] = useLocation();
const tags = useSearchParams("tag"); const tags = useSearchParams("tag");
const [entryDelay, setEntryDelay] = useState(true);
useEffect(() => {
if (tags.size) setEntryDelay(false);
}, [tags]);
if (!exp_route.test(location)) { if (!exp_route.test(location)) {
navigate("/experience", { replace: true }); navigate("/experience", { replace: true });
@ -51,13 +57,13 @@ const Exp: React.FC = () => {
</span> </span>
: :
</p> </p>
<section> <Tags
<Tags tags={["Programming", "Design", "Architecture", "Writing"]}
tags={["Programming", "Design", "Architecture", "Writing"]} selected={tags}
selected={tags} />
/> <AnimateEntry
</section> as="section"
<div delay={entryDelay ? 150 : 0}
className={cx( className={cx(
css` css`
width: 100%; width: 100%;
@ -92,7 +98,7 @@ const Exp: React.FC = () => {
}} }}
/> />
))} ))}
</div> </AnimateEntry>
</> </>
); );
}; };

10
src/pages/main/Work.tsx

@ -1,6 +1,7 @@
import React from "react"; import React from "react";
import { css, cx } from "@emotion/css"; import { css, cx } from "@emotion/css";
import { otherProjects, projects, type Project } from "./data/project"; import { otherProjects, projects, type Project } from "./data/project";
import { AnimateEntry } from "../../components/AnimateEntry";
const styles = { const styles = {
project: css` project: css`
@ -140,7 +141,8 @@ const Exp: React.FC = () => {
<> <>
<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 <AnimateEntry
as="section"
className={css` className={css`
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
@ -150,7 +152,7 @@ const Exp: React.FC = () => {
{projects.map(unit => ( {projects.map(unit => (
<ProjectUnit {...unit} key={unit.title} /> <ProjectUnit {...unit} key={unit.title} />
))} ))}
</div> </AnimateEntry>
<hr /> <hr />
<p> <p>
Apart from the above, I've also built some other interesting stuff over Apart from the above, I've also built some other interesting stuff over
@ -163,7 +165,7 @@ const Exp: React.FC = () => {
<th>Description</th> <th>Description</th>
</tr> </tr>
</thead> </thead>
<tbody> <AnimateEntry as="tbody">
{otherProjects.map(unit => ( {otherProjects.map(unit => (
<tr key={unit.title}> <tr key={unit.title}>
<td <td
@ -200,7 +202,7 @@ const Exp: React.FC = () => {
</td> </td>
</tr> </tr>
))} ))}
</tbody> </AnimateEntry>
</table> </table>
</> </>
); );

Loading…
Cancel
Save