Skip to content

Commit 018e0d1

Browse files
committed
Component Rendering Key
1 parent d41e16f commit 018e0d1

18 files changed

+277
-73
lines changed

src/example/src/app.ts

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ThemeWidget } from "./components/theme-widget";
44
import { CalloutSection } from "./sections/callout";
55
import { Footer } from "./sections/footer";
66
import { HeroSection } from "./sections/hero";
7+
import { ProjectShowcaseSection } from "./sections/project-showcase";
78

89
export const globalStore = store({
910
appName: 'haydn',
@@ -19,6 +20,8 @@ export const myApp = app(() => {
1920
2021
${HeroSection()}
2122
${CalloutSection({ header: 'Hello World', subheader: 'This is some more content' })}
23+
${ProjectShowcaseSection()}
24+
2225
${HeroSection()}
2326
2427
${Footer()}

src/example/src/components/link.module.scss

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
text-decoration-style: wavy;
5959
text-decoration-color: rgb(var(--theme-secondary));
6060
text-decoration-skip-ink: none;
61+
text-decoration-thickness: .1rem;
6162
transform: translateY(-50%);
6263
opacity: 0.75;
6364
transition: .1s ease;

src/example/src/components/nav.module.scss

+39-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
border: .2rem solid rgb(var(--theme-primary));
1111
z-index: 5;
1212
display: flex;
13+
transition: .2s ease;
1314

1415
@include theme.Mobile {
1516
right: 0;
@@ -30,10 +31,14 @@
3031
transition: .2s ease;
3132
}
3233

33-
&[data-is-open="true"]::after {
34-
background-color: rgba(0,0,0, .5);
35-
backdrop-filter: blur(0.2rem);
36-
pointer-events: auto;
34+
&[data-is-open="true"] {
35+
border-color: transparent;
36+
37+
&::after {
38+
background-color: rgba(var(--theme-background), .5);
39+
backdrop-filter: blur(0.2rem);
40+
pointer-events: auto;
41+
}
3742
}
3843
}
3944
}
@@ -49,19 +54,49 @@
4954
border-radius: 50%;
5055
-webkit-tap-highlight-color: transparent;
5156
z-index: 1;
57+
position: relative;
58+
display: flex;
59+
align-items: center;
60+
justify-content: center;
5261

5362
svg {
5463
height: 100%;
5564
width: 100%;
65+
transition: .2s ease;
5666

5767
path {
5868
stroke: rgb(var(--theme-contrast));
69+
fill: rgb(var(--theme-contrast));
70+
}
71+
72+
&:nth-child(2) {
73+
position: absolute;
74+
opacity: 0;
5975
}
6076
}
6177

6278
@include theme.NotMobile {
6379
display: none
6480
};
81+
82+
[data-is-open="true"] & {
83+
svg {
84+
transform: rotateZ(90deg);
85+
86+
&:nth-child(1) {
87+
opacity: 0;
88+
}
89+
90+
&:nth-child(2) {
91+
opacity: 1;
92+
}
93+
94+
path {
95+
stroke: rgb(var(--theme-primary));
96+
fill: rgb(var(--theme-primary));
97+
}
98+
}
99+
}
65100
}
66101

67102
.navContent {

src/example/src/components/nav.ts

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export const Navigation = component(() => {
1919
<path d="M4 12L20 12" stroke-width="2" stroke-linecap="round"/>
2020
<path d="M4 6L20 6" stroke-width="2" stroke-linecap="round"/>
2121
</svg>
22+
23+
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
24+
<path d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"/>
25+
</svg>
2226
</button>
2327
2428
<div class=${styles.navContent}>
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.projectCard {
22
padding: 1rem;
33
border-radius: 1rem;
4-
background-color: rgba(var(--theme-contrast), .1);
5-
border: .2rem solid rgba(var(--theme-contrast), .1);
4+
background-color: rgba(var(--theme-background), 1);
5+
outline: .15rem solid rgba(var(--theme-secondary), 1);
66
backdrop-filter: blur(.5rem);
77
transform-origin: 50% 50%;
88
transition: .1s ease;
@@ -11,27 +11,19 @@
1111
aspect-ratio: 16 / 9;
1212
display: flex;
1313
min-height: 8rem;
14-
15-
img {
16-
position: absolute;
17-
left: 0;
18-
top: 0;
19-
width: 100%;
20-
height: 100%;
21-
object-fit: cover;
22-
border-radius: 1rem;
23-
-webkit-mask-image: linear-gradient(to bottom right, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0.5));
24-
mask-image: linear-gradient(to bottom right, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0.5));
25-
transition: .1s ease;
26-
opacity: 0.5;
27-
}
14+
overflow: hidden;
15+
flex-shrink: 0;
2816

2917
&:hover {
30-
border: .2rem solid rgba(var(--theme-contrast), .25);
31-
transform: translateY(-.1rem) scale(1.05);
18+
outline: .2rem solid rgba(var(--theme-primary), 1);
19+
transform: translateY(-.1rem) scale(1.03);
20+
21+
.projectCardFeature {
22+
transform: scale(1.1);
23+
}
3224

33-
img {
34-
opacity: 1;
25+
.projectCardBody {
26+
color: rgba(var(--theme-contrast), 1);
3527
}
3628
}
3729
}
@@ -43,16 +35,34 @@
4335
}
4436

4537
.projectCardTitle {
46-
font-size: 1.2rem;
38+
font-size: 1.15rem;
4739
font-weight: 600;
4840
}
4941

5042
.projectCardBody {
5143
font-size: 1rem;
5244
font-weight: 400;
53-
color: rgb(var(--theme-contrast), .75);
45+
color: rgba(var(--theme-contrast), .75);
5446
}
5547

5648
.projectCardFooter {
5749
margin-top: auto;
50+
}
51+
52+
.projectCardFeature {
53+
flex: 1;
54+
overflow: hidden;
55+
position: relative;
56+
margin-left: 1rem;
57+
transition: .2s ease;
58+
59+
img {
60+
position: absolute;
61+
left: 0;
62+
top: 0;
63+
width: 100%;
64+
height: 100%;
65+
border-radius: 1rem;
66+
object-fit: cover;
67+
}
5868
}
+5-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import { component, render } from "../../../nice";
2-
import { globalStore } from "../app";
32

43
import styles from './project-card.module.scss'
54

65
export const ProjectCard = component(() => {
7-
const name = globalStore('appName');
6+
const url = "https://images.unsplash.com/photo-1682687221323-6ce2dbc803ab?q=80&w=1287&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D";
87

98
return render`
109
<article class=${styles.projectCard}>
11-
<img src="https://images.unsplash.com/photo-1682687221323-6ce2dbc803ab?q=80&w=1287&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" />
12-
1310
<div class=${styles.projectCardContent}>
1411
<p class=${styles.projectCardTitle}>OutRanked</p>
1512
<p class=${styles.projectCardBody}>Mobile App</p>
@@ -18,6 +15,10 @@ export const ProjectCard = component(() => {
1815
<p class=${styles.projectCardBody}>React • Ionic</p>
1916
</div>
2017
</div>
18+
19+
<div class=${styles.projectCardFeature}>
20+
<img src=${url} />
21+
</div>
2122
</article>
2223
`
2324
});

src/example/src/components/star.module.scss

+54-20
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@
1212
}
1313
}
1414

15+
@keyframes breathe {
16+
0% {
17+
transform: scale(0.8) rotateZ(5deg);
18+
opacity: 0.7;
19+
}
20+
50% {
21+
transform: scale(1.2) rotateZ(-5deg);
22+
opacity: 1;
23+
}
24+
100% {
25+
transform: scale(0.8) rotateZ(5deg);
26+
opacity: 0.7;
27+
}
28+
}
29+
1530
.star {
1631
position: absolute;
1732
height: 2rem;
@@ -27,52 +42,71 @@
2742
margin-top: -.5rem;
2843
filter: drop-shadow(0 0 0.5rem rgb(var(--theme-primary), .5));
2944
}
30-
31-
&::after {
32-
content: '';
33-
position: absolute;
34-
transform-origin: 50% 50%;
35-
top: 0;
36-
left: 0;
37-
width: 100%;
45+
46+
span {
3847
height: 100%;
39-
background: rgb(var(--theme-primary));
40-
animation: burstIn 0.5s ease forwards;
48+
width: 100%;
49+
display: block;
50+
animation: 3s infinite breathe;
51+
52+
&::after {
53+
content: '';
54+
position: absolute;
55+
transform-origin: 50% 50%;
56+
top: 0;
57+
left: 0;
58+
width: 100%;
59+
height: 100%;
60+
background: rgb(var(--theme-primary));
61+
animation: burstIn 0.5s ease forwards;
62+
}
4163
}
4264

43-
&.square::after {
65+
&.square>span::after {
4466
border-radius: 0;
4567
}
4668

47-
&.circle::after {
69+
&.circle>span::after {
4870
border-radius: 50%;
4971
}
5072

51-
&.triangle::after {
73+
&.triangle>span::after {
5274
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
5375
}
5476

55-
&.burst::after {
77+
&.burst>span::after {
5678
clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
5779
}
5880

59-
&:not(:last-child)::after {
60-
animation: none;
61-
}
62-
6381
&:nth-child(2n) {
6482
opacity: 1;
83+
84+
span {
85+
animation-delay: -1.5s;
86+
}
87+
}
88+
89+
&:nth-child(3n) {
90+
span {
91+
animation-delay: -.5s;
92+
}
93+
}
94+
95+
&:nth-child(5n) {
96+
span {
97+
animation-delay: -.9s;
98+
}
6599
}
66100

67101
&:nth-child(4n) {
68102
opacity: 0.25;
69103
}
70104

71-
&:nth-child(3n)::after {
105+
&:nth-child(3n)>span::after {
72106
background: rgb(var(--theme-secondary));
73107
}
74108

75-
&:nth-child(5n)::after {
109+
&:nth-child(5n)>span::after {
76110
background: linear-gradient(to bottom right, rgb(var(--theme-primary)), rgb(var(--theme-secondary)));
77111
}
78112
}

src/example/src/components/star.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const getShape = (num: number) => {
2929

3030
export const Star = component<{
3131
value: number
32+
key?: number
3233
}>(({
3334
value,
3435
}) => {
@@ -44,5 +45,5 @@ export const Star = component<{
4445

4546
const starClass = computed(() => `${getShape(value)} ${styles.star}`, [value]);
4647

47-
return render`<span class=${starClass} style=${style}></span>`
48+
return render`<span class=${starClass} style=${style}><span></span></span>`
4849
});

src/example/src/pages/index.astro

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import { myApp } from "../app";
88
<head>
99
<meta charset="utf-8" />
1010
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
11-
<meta name="viewport" content="width=device-width" />
11+
<meta
12+
name="viewport"
13+
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
14+
/>
1215
<title>Haydn Comley</title>
1316
</head>
1417
<body set:html={myApp!.html} id={myApp!.id!}>

0 commit comments

Comments
 (0)