Skip to content

Commit 6084e5c

Browse files
update in progress
1 parent e56069d commit 6084e5c

File tree

7 files changed

+191
-247
lines changed

7 files changed

+191
-247
lines changed

src/components/global/Card.astro

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
2-
interface Props {
2+
type Props = {
3+
href?: string;
34
primaryColor: string;
45
bgColor?: string;
56
scaleOnHover?: boolean;
67
pixelHeight?: string;
78
className?: string;
8-
}
9+
};
910
1011
const {
12+
href,
1113
primaryColor,
1214
bgColor = "#282828",
1315
scaleOnHover = false,
@@ -16,11 +18,34 @@ const {
1618
} = Astro.props;
1719
---
1820

19-
<div class="card z-10" class:list={[{ scale: scaleOnHover }, className]}>
20-
<div class="card-content">
21-
<slot />
22-
</div>
23-
</div>
21+
<>
22+
{
23+
href && (
24+
<a href={href}>
25+
<div
26+
class="card z-10"
27+
class:list={[{ scale: scaleOnHover }, className]}
28+
>
29+
<div class="card-content">
30+
<slot />
31+
</div>
32+
</div>
33+
</a>
34+
)
35+
}
36+
{
37+
!href && (
38+
<div
39+
class="card z-10"
40+
class:list={[{ scale: scaleOnHover }, className]}
41+
>
42+
<div class="card-content">
43+
<slot />
44+
</div>
45+
</div>
46+
)
47+
}
48+
</>
2449

2550
<style define:vars={{ primaryColor, bgColor, pixelHeight }}>
2651
* {
@@ -62,15 +87,10 @@ const {
6287
opacity: 0;
6388
}
6489

65-
.card:after {
66-
top: 65%;
67-
opacity: 0;
68-
}
69-
70-
.card:hover:after {
90+
/* .card:hover:after {
7191
top: 25%;
7292
opacity: 1;
73-
}
93+
} */
7494

7595
.card.scale {
7696
transition: transform 0.5s ease;
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<script lang="ts">
2+
import { onMount } from "svelte";
3+
import Socials from "../socials/Socials.svelte";
4+
5+
// Roles
6+
const typingInterval: number = 50;
7+
8+
function addCharacter(str1: string, str2: string) {
9+
// str1: incomplete string, add a character after this
10+
// str2: complete string, add a character from this
11+
12+
let str1Length = str1.length;
13+
let str2Length = str2.length;
14+
15+
if (str1Length < str2Length) {
16+
return str1 + str2[str1Length];
17+
} else {
18+
return str1;
19+
}
20+
}
21+
22+
function sleep(ms: number) {
23+
return new Promise((resolve) => setTimeout(resolve, ms));
24+
}
25+
26+
// Greeting
27+
let date = new Date();
28+
let hour = date.getHours();
29+
30+
let greeting: string = "";
31+
32+
if (hour >= 0 && hour < 12) {
33+
greeting = "morning";
34+
} else if (hour >= 12 && hour < 18) {
35+
greeting = "afternoon";
36+
} else if (hour >= 18) {
37+
greeting = "evening";
38+
}
39+
40+
let greetingState: string = $state("");
41+
let greetingPulse: HTMLElement;
42+
43+
async function animateGreeting(greeting: string) {
44+
for (let i = 0; i < greeting.length; i++) {
45+
greetingState = addCharacter(greetingState, greeting);
46+
47+
if (i === greeting.length - 1) {
48+
greetingPulse.classList.remove("animate-pulse");
49+
greetingPulse.classList.add("hidden");
50+
}
51+
52+
await sleep(typingInterval);
53+
}
54+
}
55+
56+
// after window finish loading, call animateRoles()
57+
onMount(async () => {
58+
animateGreeting(greeting);
59+
});
60+
</script>
61+
62+
<span>
63+
Good {greetingState}<span
64+
bind:this={greetingPulse}
65+
class="animate-pulse font-extralight">|</span
66+
></span
67+
>

src/components/home/Intro.astro

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
import Card from "../global/Card.astro";
3+
import Socials from "../socials/Socials.svelte";
4+
import Greeting from "./Greeting.svelte";
5+
---
6+
7+
<div class="w-[90%] md:w-[600px] lg:w-1/2 xl:w-1/2">
8+
<Card bgColor="#252525" primaryColor="#BEADFA" className="animate-fadeIn">
9+
<div id="intro" class="flex h-fit flex-col text-white">
10+
<div class="w-full px-5 pt-10 pb-2 lg:px-10">
11+
<div class="flex h-20 flex-row">
12+
<div class="mr-1 flex w-20 items-center justify-center">
13+
<img
14+
src="/images/pfp_new.webp"
15+
alt="Ryan"
16+
width="80"
17+
height="80"
18+
class="max-w-full rounded-full bg-[#505050]"
19+
/>
20+
</div>
21+
<div class="ml-2 flex flex-col items-start justify-center">
22+
<div
23+
id="name"
24+
class="animate-gradient text-2xl font-bold"
25+
>
26+
RythonDev
27+
</div>
28+
<div class="w-full text-xl">Full Stack Developer</div>
29+
</div>
30+
</div>
31+
<div id="uwu" class="hidden items-center justify-center">
32+
<img
33+
src="/images/RythonDev-UwU-compressed.webp"
34+
alt="RythonDev"
35+
width="400"
36+
height="131.8"
37+
/>
38+
</div>
39+
<div class="mt-5 mb-5 text-2xl font-bold">
40+
<Greeting client:load />, <br class="sm:hidden" />I'm Ryan!
41+
</div>
42+
<p class="text-left">
43+
Born and raised in Malaysia, I'm currently pursuing a
44+
Bachelor's in Computer Science in Australia.
45+
</p>
46+
<br />
47+
<p class="text-left">
48+
My work has connected me with Twitch streamers and content
49+
creators, and I'm driven by interests in web development,
50+
computer vision, and data science.
51+
</p>
52+
53+
<div class="mt-8 flex flex-row items-center justify-center">
54+
<Socials />
55+
</div>
56+
</div>
57+
</div>
58+
</Card>
59+
</div>
60+
61+
<style>
62+
#name {
63+
background: linear-gradient(
64+
90deg,
65+
#16ff00 0%,
66+
#72ffff 45%,
67+
#0096ff 100%
68+
);
69+
70+
background-size: 300%;
71+
72+
background-clip: text;
73+
-webkit-background-clip: text;
74+
75+
-webkit-text-fill-color: transparent;
76+
}
77+
</style>

0 commit comments

Comments
 (0)