Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: change grid implementation

Francesco Sansalvadoreb17e3f4e4111
diff --git a/apps/www/components/Hero/HeroBackground.tsx b/apps/www/components/Hero/HeroBackground.tsx
index b6f710dc23c..ed3d6d1aa56 100644
--- a/apps/www/components/Hero/HeroBackground.tsx
+++ b/apps/www/components/Hero/HeroBackground.tsx
@@ -22,6 +22,55 @@ const HeroBackground = () => {
const svgPath =
'M2.16005e-05 -0.000998163L1680 0.129286V234L890.763 1012.41C859.46 1043.28 809.108 1043.11 778.018 1012.02L-0.000248139 234.001L2.16005e-05 -0.000998163Z'
+ const svgGridOptions = {
+ color: '#02828b',
+ boxWidth: width ? width * 7 : 7500,
+ boxHeight: width ? width * 5 : 6000,
+ xLines: isSm ? 20 : 50,
+ yLines: isSm ? 65 : 130,
+ strokeWidth: 1,
+ }
+
+ const GridSVG = () => (
+ <svg
+ preserveAspectRatio="none"
+ width="100%"
+ height="100%"
+ viewBox={`0 0 ${svgGridOptions.boxWidth} ${svgGridOptions.boxHeight}`}
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ {[...new Array(svgGridOptions.yLines)].map((_: any, i: number) => {
+ const y = (svgGridOptions.boxWidth * i) / svgGridOptions.yLines
+ return (
+ <line
+ key={`y-${i}`}
+ x1={svgGridOptions.boxHeight}
+ y1={y}
+ x2="0"
+ y2={y}
+ stroke={svgGridOptions.color}
+ strokeWidth={svgGridOptions.strokeWidth}
+ />
+ )
+ })}
+ {[...new Array(svgGridOptions.xLines)].map((_: any, i: number) => {
+ const x = (svgGridOptions.boxHeight * i) / svgGridOptions.xLines
+ return (
+ <line
+ key={`x-${i}`}
+ x1={x}
+ y1={svgGridOptions.boxWidth}
+ x2={x}
+ y2="0"
+ stroke={svgGridOptions.color}
+ strokeWidth={svgGridOptions.strokeWidth}
+ />
+ )
+ })}
+ </svg>
+ )
+
return (
<>
<div
@@ -90,7 +139,7 @@ const HeroBackground = () => {
</div>
<div
className={[
- 'absolute top-0 left-0 w-full h-[600px] lg:h-[800px] overflow-hidden pointer-events-none',
+ 'absolute inset-0 w-full h-[600px] lg:h-[800px] overflow-hidden pointer-events-none',
styles['hero-container'],
].join(' ')}
>
@@ -117,7 +166,9 @@ const HeroBackground = () => {
right: 0,
}}
>
- <div className={[styles['hero-grid-lines']].join(' ')} />
+ <div className={[styles['hero-grid-lines']].join(' ')}>
+ <GridSVG />
+ </div>
</div>
</div>
</div>
diff --git a/apps/www/components/Hero/hero.module.css b/apps/www/components/Hero/hero.module.css
index 82801910187..bf7f5725502 100644
--- a/apps/www/components/Hero/hero.module.css
+++ b/apps/www/components/Hero/hero.module.css
@@ -1,33 +1,20 @@
.hero-container {
- position: absolute;
z-index: -6;
- overflow: hidden;
- inset: 0;
transition: perspective 3s ease 0s;
}
.hero-grid-lines {
position: absolute;
- width: 200vw;
- height: 200vh;
- margin-left: -50%;
+ width: 120vw;
+ height: 120vh;
+ margin-left: 0%;
transform: translateY(0);
- background-image: linear-gradient(to right, #026269 45%, transparent 50%, #026269 55%);
- -webkit-mask-image: linear-gradient(90deg, #000 1px, transparent 0),
- linear-gradient(180deg, #000 1px, transparent 0);
- mask-image: linear-gradient(90deg, #000 1px, #000 0), linear-gradient(180deg, #000 1px, #000 0);
- -webkit-mask-size: 25px 25px;
- mask-size: 25px 25px;
overflow: hidden;
- -webkit-mask-repeat: repeat;
- mask-repeat: repeat;
display: flex;
align-items: center;
justify-content: center;
- inset: -100% 0;
- background-position-y: 100%;
- -webkit-mask-position: 50% 0;
- mask-position: 50% 0;
+ inset: 0;
+ margin: 0 auto;
animation: animate-grid 30s linear infinite;
}
@@ -58,14 +45,12 @@
@media (min-width: 1024px) {
.hero-grid-lines {
animation-duration: 30s;
- -webkit-mask-size: 40px 40px;
- mask-size: 40px 40px;
}
}
@keyframes animate-grid {
0% {
- transform: translateY(200px);
+ transform: translateY(500px);
}
to {