Skip to content

Commit da74ea7

Browse files
Feat/website improvements (#409)
* fix(ui): support href for links * fix(website): fix duplicate data-hk attr * fix(ui/website): fix ssr rendering for button/box/text components * perf(website): hydration * build(website): fix build * fix(website): improvements * feat(website): firefox editor steps improvements styles * fix: colors for safari * feat(website): header dynamic color * feat(website): project showcase update image and styles * fix(website): analytics card animation * fix(website): analytics card styles improvements * chore(website): lint and typecheck fix Co-authored-by: Riccardo Perra <[email protected]>
1 parent 21746dc commit da74ea7

29 files changed

+459
-242
lines changed
28.4 KB
Loading
-9.06 KB
Binary file not shown.

apps/website/src/components/FeatureCard/FeatureCard.css.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ export const card = style([
2727
},
2828
responsiveStyle({
2929
mobile: {
30-
borderRadius: '32px',
30+
borderRadius: [cardOuterRadius],
31+
gap: '44px',
3132
minHeight: '512px',
3233
vars: {
33-
[cardOuterRadius]: '32px',
34+
[cardOuterRadius]: '24px',
35+
[cardPadding]: '32px',
3436
},
3537
},
3638
desktop: {
39+
gap: '96px',
3740
flexDirection: 'row',
38-
borderRadius: '96px',
3941
minHeight: '564px',
4042
vars: {
4143
[cardOuterRadius]: '96px',
@@ -67,6 +69,9 @@ export const imageSection = style([
6769
opacity: 1,
6870
height: '300px',
6971
width: '100%',
72+
// @ts-expect-error No present in types. This is for safari absolute + overflow hidden bug
73+
'-webkitMaskImage':
74+
'-webkit-radial-gradient(circle, white 100%, black 100%)',
7075
},
7176
responsiveStyle({
7277
mobile: {
@@ -83,7 +88,7 @@ export const imageSection = style([
8388
export const imageWrapper = style({
8489
aspectRatio: '2 / 1',
8590
flex: '0 0 auto',
86-
borderRadius: '32px',
91+
borderRadius: `16px`,
8792
height: '568px',
8893
left: '48px',
8994
overflow: 'hidden',

apps/website/src/components/Footer/Footer.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {HStack, Link, Text, VStack} from '@codeimage/ui';
1+
import {HStack, Link, Text} from '@codeimage/ui';
22
import {A} from '@solidjs/router';
33
import * as styles from '~/components/Footer/Footer.css';
44

@@ -15,23 +15,20 @@ export default function Footer() {
1515
<Link
1616
class={styles.link}
1717
underline={true}
18-
as={A}
1918
href={'https://github.com/riccardoperra/codeimage'}
2019
title="Github repository"
2120
children={'Github'}
2221
/>
2322
<Link
2423
class={styles.link}
2524
underline={true}
26-
as={A}
2725
href={'https://github.com/riccardoperra/codeimage/issues'}
2826
title="Issues"
2927
children={'Issues & Feedback'}
3028
/>
3129
<Link
3230
class={styles.link}
3331
underline={true}
34-
as={A}
3532
href={'https://github.com/riccardoperra/codeimage/releases'}
3633
title="Releases"
3734
children={'Releases'}

apps/website/src/components/Header/Header.css.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {themeVars} from '@codeimage/ui';
2-
import {darkGrayScale} from '@codeimage/ui/themes/darkTheme';
32
import {createTheme, createVar, style} from '@vanilla-extract/css';
43

54
export const [toolbarTheme, toolbarVars] = createTheme({
@@ -9,11 +8,14 @@ export const [toolbarTheme, toolbarVars] = createTheme({
98

109
const headerBorderColor = createVar();
1110

11+
export const headerBgColor = createVar();
12+
1213
export const header = style([
1314
toolbarTheme,
1415
{
1516
vars: {
1617
[headerBorderColor]: 'rgba(0,0,0,0)',
18+
[headerBgColor]: 'rgba(12, 12, 12, 0.6)',
1719
},
1820
display: 'flex',
1921
position: 'fixed',
@@ -24,7 +26,7 @@ export const header = style([
2426
transition: 'border-color 250ms ease-in-out',
2527
selectors: {
2628
'&[data-scrolled=true]': {
27-
backgroundColor: `rgba(12, 12, 12, 0.6)`,
29+
backgroundColor: headerBgColor,
2830
backdropFilter: 'saturate(180%) blur(20px)',
2931
// @ts-expect-error: Why not working
3032
'-webkitBackdropFilter': 'saturate(180%) blur(20px)',

apps/website/src/components/Header/Header.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import {Button} from '@codeimage/ui';
2-
import {A} from '@solidjs/router';
2+
import {assignInlineVars} from '@vanilla-extract/dynamic';
33
import {createMemo, createSignal, onCleanup, onMount} from 'solid-js';
4-
import {injectBreakpoints} from '~/core/breakpoints';
4+
import {mainWebsiteLink} from '~/core/constants';
5+
import {getUiStore} from '~/ui';
56
import {CodeImageLogoSvg} from '../CodeImageLogo/CodeImageLogoSvg';
67
import {content} from '../Main/MainPage.css';
78
import * as styles from './Header.css';
89

910
export function Header() {
1011
const [scrolled, setScrolled] = createSignal(false);
11-
const bp = injectBreakpoints();
12+
const ui = getUiStore();
1213
onMount(() => {
1314
const contentEl = document.querySelector(`.${content}`) as HTMLElement;
1415
const observer = new IntersectionObserver(
@@ -25,15 +26,20 @@ export function Header() {
2526
const dataScrolled = createMemo(() => scrolled());
2627

2728
return (
28-
<div class={styles.header} data-scrolled={dataScrolled() ?? false}>
29+
<div
30+
class={styles.header}
31+
style={assignInlineVars({
32+
[styles.headerBgColor]: `${ui.value.navColor}20`,
33+
})}
34+
data-scrolled={dataScrolled() ?? false}
35+
>
2936
<div class={styles.headerContent}>
3037
<div class={styles.headerContentInner}>
3138
<CodeImageLogoSvg height={32} width={164} />
3239
<div class={styles.headerActions}>
3340
<Button
3441
as={'a'}
35-
link={true}
36-
href="https://codeimage.dev"
42+
href={mainWebsiteLink}
3743
variant="solid"
3844
theme="primary"
3945
>

apps/website/src/components/Landing/ComingSoon/ComingSoon.css.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,24 @@ export const rightCardAnalytics = style({
133133
gap: '24px',
134134
});
135135

136-
export const analyticsCard = style({
137-
width: '224px',
138-
height: '140px',
139-
boxSizing: 'content-box',
140-
background: themeVars.backgroundColor.purple['200'],
141-
padding: '24px',
142-
borderRadius: '32px',
143-
color: themeVars.textColor.gray['800'],
144-
});
136+
export const analyticsCard = style([
137+
{
138+
width: '224px',
139+
height: '140px',
140+
boxSizing: 'content-box',
141+
background: themeVars.backgroundColor.purple['200'],
142+
padding: '24px',
143+
color: themeVars.textColor.gray['800'],
144+
},
145+
responsiveStyle({
146+
mobile: {
147+
borderRadius: `16px`,
148+
},
149+
desktop: {
150+
borderRadius: '32px',
151+
},
152+
}),
153+
]);
145154

146155
export const image = style({
147156
pointerEvents: 'none',

apps/website/src/components/Landing/ComingSoon/ComingSoon.tsx

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Badge, Box, SvgIconProps, Text} from '@codeimage/ui';
2-
import {animate, scroll} from 'motion';
3-
import {onMount} from 'solid-js';
2+
import {Motion} from '@motionone/solid';
3+
import {animate, inView, scroll} from 'motion';
4+
import {createSignal, FlowProps, onMount} from 'solid-js';
45
import {
56
FeatureCard,
67
FeatureContent,
@@ -53,20 +54,27 @@ function DocumentText(props: SvgIconProps) {
5354
}
5455

5556
export default function ComingSoon() {
56-
let cardRef: HTMLDivElement;
57+
let analyticsCardRef: HTMLDivElement;
5758
let themeBuilderRef: HTMLDivElement;
5859
let embedsRef: HTMLDivElement;
5960
const bp = injectBreakpoints();
6061

62+
const [analyticsInView, setAnalyticsInView] = createSignal(true);
63+
6164
onMount(() => {
6265
if (!bp.isXs()) {
63-
[cardRef, themeBuilderRef, embedsRef].forEach(ref => {
66+
[analyticsCardRef, themeBuilderRef, embedsRef].forEach(ref => {
6467
scroll(animate(ref, {opacity: [0, 1, 1, 0], scale: [0.7, 1, 1, 1]}), {
6568
target: ref,
6669
offset: ['start end', 'end end', 'start start', 'end start'],
6770
});
6871
});
6972
}
73+
74+
inView(analyticsCardRef, () => {
75+
setAnalyticsInView(true);
76+
return () => setAnalyticsInView(false);
77+
});
7078
});
7179

7280
return (
@@ -120,11 +128,14 @@ export default function ComingSoon() {
120128
</FeatureCard>
121129
</Box>
122130
<Box marginTop={8}>
123-
<FeatureCard ref={cardRef} class={styles.analyticsFeatureCard}>
131+
<FeatureCard
132+
ref={analyticsCardRef}
133+
class={styles.analyticsFeatureCard}
134+
>
124135
<FeatureImageContent bgColor={rootThemeVars.purple}>
125136
<div class={styles.analyticsCardContainer}>
126137
<div class={styles.leftCardAnalytics}>
127-
<div class={styles.analyticsCard}>
138+
<AnalyticsCardBoxAnimation inView={analyticsInView()}>
128139
<Text size={'lg'} weight={'bold'}>
129140
Angular Change Detection
130141
</Text>
@@ -139,8 +150,8 @@ export default function ComingSoon() {
139150
views
140151
</Box>
141152
</Box>
142-
</div>
143-
<div class={styles.analyticsCard}>
153+
</AnalyticsCardBoxAnimation>
154+
<AnalyticsCardBoxAnimation inView={analyticsInView()}>
144155
<Text size={'lg'} weight={'bold'}>
145156
Solid Reactivity Example
146157
</Text>
@@ -155,10 +166,10 @@ export default function ComingSoon() {
155166
views
156167
</Box>
157168
</Box>
158-
</div>
169+
</AnalyticsCardBoxAnimation>
159170
</div>
160171
<div class={styles.rightCardAnalytics}>
161-
<div class={styles.analyticsCard}>
172+
<AnalyticsCardBoxAnimation inView={analyticsInView()}>
162173
<Text size={'lg'} weight={'bold'}>
163174
Rxjs operators
164175
</Text>
@@ -173,8 +184,8 @@ export default function ComingSoon() {
173184
views
174185
</Box>
175186
</Box>
176-
</div>
177-
<div class={styles.analyticsCard}>
187+
</AnalyticsCardBoxAnimation>
188+
<AnalyticsCardBoxAnimation inView={analyticsInView()}>
178189
<Text size={'lg'} weight={'bold'}>
179190
Jest vs Jasmine
180191
</Text>
@@ -189,7 +200,7 @@ export default function ComingSoon() {
189200
views
190201
</Box>
191202
</Box>
192-
</div>
203+
</AnalyticsCardBoxAnimation>
193204
</div>
194205
</div>
195206
</FeatureImageContent>
@@ -199,7 +210,7 @@ export default function ComingSoon() {
199210
</Badge>
200211
<Box>
201212
<Text size={'5xl'} weight={'bold'}>
202-
Measure your engagement
213+
Measure the engagement
203214
</Text>
204215
<Box marginY={4}>
205216
<div class={styles.comingSoonBadge}>Coming in 2023</div>
@@ -220,3 +231,19 @@ export default function ComingSoon() {
220231
</div>
221232
);
222233
}
234+
235+
function AnalyticsCardBoxAnimation(props: FlowProps<{inView: boolean}>) {
236+
return (
237+
<Motion.div
238+
animate={{
239+
transform: props.inView
240+
? 'translateY(0px) scale(1)'
241+
: 'translateY(40px) scale(0.7)',
242+
opacity: props.inView ? 1 : 0.4,
243+
}}
244+
class={styles.analyticsCard}
245+
>
246+
{props.children}
247+
</Motion.div>
248+
);
249+
}

apps/website/src/components/Landing/EditorSteps/EditorSteps.css.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,24 @@ export const backdrop = style({
3030
bottom: 0,
3131
left: 0,
3232
transform: 'translate3d(0px, -50%, 0) scale(0.90)',
33-
filter: 'blur(500px) saturate(300%)',
33+
filter: 'blur(500px) saturate(200%)',
3434
opacity: '0.7',
3535
transition: 'opacity 0.3s',
3636
borderRadius: '1.5rem',
3737
flex: 1,
3838
overflow: 'hidden',
3939
height: '500px',
4040
top: '50%',
41+
'@media': {
42+
'(min--moz-device-pixel-ratio:0)': {
43+
// Trying to simulate Chrome/Safari blurry effect with firefox
44+
transform: 'translate3d(0, 0, 0) scale(0.90)',
45+
height: '100%',
46+
top: 0,
47+
opacity: 0.3,
48+
filter: 'blur(200px)',
49+
},
50+
},
4151
});
4252

4353
export const stickyContent = style([

apps/website/src/components/Landing/EditorSteps/EditorSteps.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {backgroundColorVar} from '@codeimage/ui';
22
import {assignInlineVars} from '@vanilla-extract/dynamic';
33
import {inView, scroll} from 'motion';
4-
import {onMount} from 'solid-js';
4+
import {createEffect, onMount} from 'solid-js';
55
import {
66
gradientBlueBg,
77
gradientPurpleBg,
@@ -12,10 +12,12 @@ import * as styles from './EditorSteps.css';
1212
import {injectEditorScene} from './scene';
1313
import {StepCardArea} from './StepCardScene/StepCardScene';
1414

15-
export default function EditorSteps() {
15+
export default function EditorSteps(props: {test: number}) {
1616
const scene = injectEditorScene();
1717
let ref: HTMLElement;
1818

19+
createEffect(() => console.log(props.test, props));
20+
1921
const backgrounds = {
2022
0: gradientBlueBg,
2123
1: gradientPurpleBg,

apps/website/src/components/Landing/EditorSteps/StepCard/StepCard.css.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ export const container = style([
3333
opacity: disabledOpacity,
3434
},
3535
},
36+
'@media': {
37+
'(min--moz-device-pixel-ratio:0)': {
38+
// Trying to simulate Chrome/Safari blurry effect with firefox
39+
backgroundColor: 'rgb(0 0 0 / 0.35)',
40+
},
41+
},
3642
},
3743
responsiveStyle({
3844
mobile: {

apps/website/src/components/Landing/EditorSteps/scene.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ export function createEditorScene() {
3333

3434
const currentStep = createMemo(() => getStep(progress()));
3535

36+
const canAnimateNavbar = createMemo(() => progress() > 0);
37+
3638
createEffect(
37-
on([inView, currentStep], ([inView, currentStep]) => {
38-
if (!inView) {
39-
uiStore.set('navColor', undefined);
40-
} else {
41-
uiStore.set('navColor', stepsMainColors[currentStep]);
42-
}
43-
}),
39+
on(
40+
[inView, canAnimateNavbar, currentStep],
41+
([inView, canAnimateNavbar, currentStep]) => {
42+
if (!inView) {
43+
uiStore.set('navColor', undefined);
44+
} else if (canAnimateNavbar) {
45+
uiStore.set('navColor', stepsMainColors[currentStep]);
46+
}
47+
},
48+
),
4449
);
4550

4651
return {

0 commit comments

Comments
 (0)