Skip to content

Commit a6077ed

Browse files
committed
feat: parallax background
1 parent 5509c0a commit a6077ed

9 files changed

Lines changed: 73 additions & 6 deletions

File tree

portable/assets/parallax-d.svg

Lines changed: 1 addition & 0 deletions
Loading

portable/assets/parallax-l.svg

Lines changed: 1 addition & 0 deletions
Loading

portable/src/assets/assets.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// AUTO GENERATED FILE - DO NOT EDIT
22

33
const assetData = {
4-
'logo.png': '/assets/logo.png'
4+
'logo.png': '/assets/logo.png',
5+
'parallax-d.svg': '/assets/parallax-d.svg',
6+
'parallax-l.svg': '/assets/parallax-l.svg'
57
} as const;
68

79
export type AssetName = (keyof typeof assetData);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { useAsset } from "@assets";
2+
import { Container } from "@components/ui/structure/container";
3+
import { useClasses } from "@styles";
4+
5+
export function Parallax() {
6+
return (
7+
<Container
8+
className={useClasses("parallax")}
9+
children={null}
10+
attributes={{
11+
"img-l-src": `url("${useAsset("parallax-l.svg")}")`,
12+
"img-d-src": `url("${useAsset("parallax-d.svg")}")`,
13+
}}
14+
/>
15+
)
16+
}
17+

portable/src/routes/home.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Footer } from "@components/block/footer";
2+
import { Parallax } from "@components/block/parallax";
23
import { Menu } from "@components/kit/menu";
34
import { MenuBrand } from "@components/kit/menu-brand";
45
import { ScrollTopButton } from "@components/kit/scroll-top-button";
@@ -14,6 +15,8 @@ function Layout({ forwarded, dynamic, children }: LayoutProps) {
1415
const path = `/${dynamic}/${forwarded?.join('/')}`;
1516

1617
return <>
18+
<Parallax />
19+
1720
<Container>
1821
<Menu position="top-left">
1922
<MenuBrand />

portable/src/styles/styles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const classNames = {
5353
'menu-top-right': 'menu-top-right',
5454
'node-bg': 'node-bg',
5555
'node-bg-node': 'node-bg-node',
56+
'parallax': 'parallax',
5657
'scrollpop': 'scrollpop',
5758
'section': 'section',
5859
'section-content': 'section-content',

portable/styles/app/block/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
@import './footer.css';
55
@import './hero.css';
66
@import './jumps.css';
7+
@import './parallax.css';
78
@import './socials.css';
89
@import './sponsor.css';
910
@import './timeline.css';
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@keyframes parallax {
2+
0% {
3+
transform: translateY(0);
4+
}
5+
6+
100% {
7+
transform: translateY(-100vh);
8+
}
9+
}
10+
11+
.parallax {
12+
position: fixed !important;
13+
display: block;
14+
width: 100%;
15+
height: 200vh;
16+
top: 0;
17+
left: 0;
18+
animation: parallax linear;
19+
animation-timeline: scroll();
20+
opacity: 0.0625;
21+
background-image: var(--img-l-src);
22+
}
23+
24+
.dark .parallax {
25+
background-image: var(--img-d-src);
26+
}
27+

portable/styles/core/base.css

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@
2929
}
3030

3131
html, body, #app {
32-
min-height: 100%;
33-
width: 100%;
34-
height: 100%;
35-
3632
font-size: 16px;
3733
font-family: var(--font-sans);
3834

@@ -42,16 +38,30 @@ html, body, #app {
4238
cursor: default;
4339
position: relative;
4440
transition: none;
45-
overflow-x: hidden;
4641
}
4742

4843
html, body {
4944
background-color: var(--color-shine);
5045
}
5146

47+
html {
48+
min-height: 100%;
49+
width: 100vw;
50+
height: 100%;
51+
}
52+
53+
body {
54+
width: 100%;
55+
height: 100%;
56+
overflow-x: hidden;
57+
overflow-y: auto;
58+
}
59+
5260
#app {
5361
display: flex;
5462
flex-direction: column;
63+
width: 100%;
64+
max-width: 100%;
5565
}
5666

5767
svg {
@@ -69,3 +79,7 @@ svg {
6979
border-radius: 0.25rem;
7080
}
7181

82+
::-webkit-scrollbar-track {
83+
background-color: transparent;
84+
}
85+

0 commit comments

Comments
 (0)