|
1 | 1 | import styles from "./AboutMe.module.css"; |
2 | 2 | import ScrambleText from "@/components/ScrambleText/ScrambleText"; |
| 3 | +import ScrambleCard from "@/components/ScrambleCard/ScrambleCard"; |
3 | 4 | import { SCRAMBLE_DURATION, GAP } from "@/lib/scrambleConfig"; |
4 | 5 | import { aboutContent } from "@/lib/pageContent"; |
5 | 6 |
|
| 7 | +const STEP = SCRAMBLE_DURATION + GAP; |
| 8 | +const TOTAL = SCRAMBLE_DURATION; |
| 9 | + |
| 10 | +const HEADING_DELAY = 0; |
| 11 | +const INTRO_DELAY = HEADING_DELAY + STEP; |
| 12 | +const BENTO_0_DELAY = INTRO_DELAY + STEP; |
| 13 | +const BENTO_1_DELAY = BENTO_0_DELAY + STEP; |
| 14 | +const BENTO_2_DELAY = BENTO_1_DELAY + STEP; |
| 15 | +const BENTO_3_DELAY = BENTO_2_DELAY + STEP; |
| 16 | +const OUTRO_DELAY = BENTO_3_DELAY + STEP; |
| 17 | + |
| 18 | +function slices(cardDelay: number, n: number): Array<{ delay: number; duration: number }> { |
| 19 | + const duration = TOTAL / n; |
| 20 | + return Array.from({ length: n }, (_, i) => ({ |
| 21 | + delay: cardDelay + i * duration, |
| 22 | + duration, |
| 23 | + })); |
| 24 | +} |
| 25 | + |
6 | 26 | export default function AboutMe() { |
7 | 27 |
|
8 | | - return( |
9 | | - <section className={styles.section} id="about"> |
10 | | - <div> |
11 | | - <ScrambleText as="h1" text={aboutContent.heading} className={styles.heading} delay={0}/> |
12 | | - <ScrambleText as="p" text={aboutContent.intro} className={styles.textBlock} delay={SCRAMBLE_DURATION + GAP}/> |
13 | | - </div> |
14 | | - <div className={styles.bentoGrid}> |
15 | | - <div className={`${styles.bentoBox} ${styles.wide} ${styles.mobileHidden}`}> |
16 | | - <h3 className={styles.boxTitle}>Setup</h3> |
17 | | - <div className={styles.tagContainer}> |
18 | | - <span className={styles.tag}>Arch Linux</span> |
19 | | - <span className={styles.tag}>NeoVim</span> |
20 | | - <span className={styles.tag}>VS Code</span> |
21 | | - <span className={styles.tag}>Tmux</span> |
22 | | - </div> |
23 | | - </div> |
24 | | - <div className={`${styles.bentoBox} ${styles.tall}`}> |
25 | | - <h3 className={styles.boxTitle}>Learning</h3> |
26 | | - <div className={styles.list}> |
27 | | - <span className={styles.listItems}>DevOps</span> |
28 | | - <span className={styles.listItems}>Ansible</span> |
29 | | - <span className={styles.listItems}>Terraform</span> |
30 | | - <span className={styles.listItems}>Django</span> |
31 | | - <span className={styles.listItems}>Structure Design</span> |
32 | | - </div> |
33 | | - </div> |
34 | | - <div className={`${styles.bentoBox} ${styles.mobileHidden} ${styles.optional}`}> |
35 | | - <h3 className={styles.boxTitle}>Location</h3> |
36 | | - <p className={styles.boxValue}>India (IIT BHU)</p> |
37 | | - </div> |
38 | | - <div className={`${styles.bentoBox} ${styles.mobileHidden} ${styles.optional}`}> |
39 | | - <h3 className={styles.boxTitle}>Hobbies</h3> |
40 | | - <p className={styles.boxValue}>Music</p> |
41 | | - </div> |
42 | | - </div> |
43 | | - <div className={styles.textBlock}> |
44 | | - <ScrambleText as="p" text={aboutContent.outro} delay={SCRAMBLE_DURATION * 2 + GAP}/> |
45 | | - </div> |
46 | | - </section> |
47 | | - ) |
| 28 | + const setup = slices(BENTO_0_DELAY, 5); |
| 29 | + const learning = slices(BENTO_3_DELAY, 6); |
| 30 | + const location = slices(BENTO_1_DELAY, 2); |
| 31 | + const hobbies = slices(BENTO_2_DELAY, 2); |
| 32 | + |
| 33 | + return ( |
| 34 | + <section className={styles.section} id="about"> |
| 35 | + <div> |
| 36 | + <ScrambleText as="h1" text={aboutContent.heading} className={styles.heading} delay={HEADING_DELAY} /> |
| 37 | + <ScrambleText as="p" text={aboutContent.intro} className={styles.textBlock} delay={INTRO_DELAY} /> |
| 38 | + </div> |
| 39 | + |
| 40 | + <div className={styles.bentoGrid}> |
| 41 | + |
| 42 | + <ScrambleCard delay={BENTO_0_DELAY} className={`${styles.bentoBox} ${styles.wide} ${styles.mobileHidden}`}> |
| 43 | + <h3 className={styles.boxTitle}> |
| 44 | + <ScrambleText as="span" text="Setup" delay={setup[0].delay} duration={setup[0].duration} /> |
| 45 | + </h3> |
| 46 | + <div className={styles.tagContainer}> |
| 47 | + <ScrambleText as="span" text="Arch Linux" className={styles.tag} delay={setup[1].delay} duration={setup[1].duration} /> |
| 48 | + <ScrambleText as="span" text="NeoVim" className={styles.tag} delay={setup[2].delay} duration={setup[2].duration} /> |
| 49 | + <ScrambleText as="span" text="VS Code" className={styles.tag} delay={setup[3].delay} duration={setup[3].duration} /> |
| 50 | + <ScrambleText as="span" text="Tmux" className={styles.tag} delay={setup[4].delay} duration={setup[4].duration} /> |
| 51 | + </div> |
| 52 | + </ScrambleCard> |
| 53 | + |
| 54 | + <ScrambleCard delay={BENTO_3_DELAY} className={`${styles.bentoBox} ${styles.tall}`}> |
| 55 | + <h3 className={styles.boxTitle}> |
| 56 | + <ScrambleText as="span" text="Learning" delay={learning[0].delay} duration={learning[0].duration} /> |
| 57 | + </h3> |
| 58 | + <div className={styles.list}> |
| 59 | + <ScrambleText as="span" text="DevOps" className={styles.listItems} delay={learning[1].delay} duration={learning[1].duration} /> |
| 60 | + <ScrambleText as="span" text="Ansible" className={styles.listItems} delay={learning[2].delay} duration={learning[2].duration} /> |
| 61 | + <ScrambleText as="span" text="Terraform" className={styles.listItems} delay={learning[3].delay} duration={learning[3].duration} /> |
| 62 | + <ScrambleText as="span" text="Django" className={styles.listItems} delay={learning[4].delay} duration={learning[4].duration} /> |
| 63 | + <ScrambleText as="span" text="Structure Design" className={styles.listItems} delay={learning[5].delay} duration={learning[5].duration} /> |
| 64 | + </div> |
| 65 | + </ScrambleCard> |
| 66 | + |
| 67 | + <ScrambleCard delay={BENTO_1_DELAY} className={`${styles.bentoBox} ${styles.mobileHidden} ${styles.optional}`}> |
| 68 | + <h3 className={styles.boxTitle}> |
| 69 | + <ScrambleText as="span" text="Location" delay={location[0].delay} duration={location[0].duration} /> |
| 70 | + </h3> |
| 71 | + <ScrambleText as="p" text="India (IIT BHU)" className={styles.boxValue} delay={location[1].delay} duration={location[1].duration} /> |
| 72 | + </ScrambleCard> |
| 73 | + |
| 74 | + <ScrambleCard delay={BENTO_2_DELAY} className={`${styles.bentoBox} ${styles.mobileHidden} ${styles.optional}`}> |
| 75 | + <h3 className={styles.boxTitle}> |
| 76 | + <ScrambleText as="span" text="Hobbies" delay={hobbies[0].delay} duration={hobbies[0].duration} /> |
| 77 | + </h3> |
| 78 | + <ScrambleText as="p" text="Music" className={styles.boxValue} delay={hobbies[1].delay} duration={hobbies[1].duration} /> |
| 79 | + </ScrambleCard> |
| 80 | + |
| 81 | + </div> |
48 | 82 |
|
| 83 | + <div className={styles.textBlock}> |
| 84 | + <ScrambleText as="p" text={aboutContent.outro} delay={OUTRO_DELAY} /> |
| 85 | + </div> |
| 86 | + </section> |
| 87 | + ); |
49 | 88 | } |
0 commit comments