The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: add ShinyBox component
Francesco Sansalvadorea8134da1196a
diff --git a/apps/www/components/Features/FeatureCard.tsx b/apps/www/components/Features/FeatureCard.tsxindex fc34d16690f..fb629f20b3f 100644--- a/apps/www/components/Features/FeatureCard.tsx+++ b/apps/www/components/Features/FeatureCard.tsx@@ -1,6 +1,7 @@import React from 'react'import { LazyMotion, domAnimation, m } from 'framer-motion'import Link from 'next/link'+import ShinyBox from '../ShinyBox'const FeatureCard = ({classname,@@ -26,23 +27,29 @@ const FeatureCard = ({].join(' ')}onClick={onClick}>- <m.div- className={`relative overflow-hidden group/2 flex-1 flex flex-col items-center gap-5 lg:items-start justify-between bg-scale-100- w-full border dark:border-scale-300 border-scale-600 hover:border-brand-900 hover:dark:border-brand-700 rounded-xl h-full px-6 py-12 shadow-lg`}- initial="default"- animate="default"- whileHover="hover"+ <ShinyBox+ outerClassName="relative w-full h-full group/2 shadow-lg p-0 dark:bg-scale-400 bg-scale-600 hover:!bg-brand-600"+ innerClassName="relative overflow-hidden flex-1 flex flex-col items-center gap-5 hover:!bg-brand-600 lg:items-start justify-between bg-scale-100+ w-full rounded-xl h-full">- <dl className="relative z-10 flex flex-col items-center mx-auto text-center gap-2 text-scale-1200">- <dt>- <h2 className="text-xl">{title}</h2>- </dt>- <dd>- <p className="text-sm text-scale-1000">{subtitle}</p>- </dd>- </dl>- {image}- </m.div>+ <m.div+ className={`relative flex-1 flex flex-col items-center gap-5 lg:items-start justify-between bg-scale-100+ w-full rounded-xl h-full px-6 py-12`}+ initial="default"+ animate="default"+ whileHover="hover"+ >+ <dl className="relative z-10 flex flex-col items-center mx-auto text-center gap-2 text-scale-1200">+ <dt>+ <h2 className="text-xl">{title}</h2>+ </dt>+ <dd>+ <p className="text-sm text-scale-1000">{subtitle}</p>+ </dd>+ </dl>+ {image}+ </m.div>+ </ShinyBox></a></Link></LazyMotion>diff --git a/apps/www/components/ShinyBox/index.tsx b/apps/www/components/ShinyBox/index.tsxnew file mode 100644index 00000000000..0cc6bc084b8--- /dev/null+++ b/apps/www/components/ShinyBox/index.tsx@@ -0,0 +1,64 @@+import React, { PropsWithChildren, useEffect, useRef } from 'react'++const ShinyBox = ({+ outerClassName,+ innerClassName,+ children,+}: PropsWithChildren<{ outerClassName?: string; innerClassName?: string }>) => {+ const outerRef = useRef(null)+ const innerRef = useRef(null)++ const handleGlow = (event: any) => {+ if (!outerRef.current || !innerRef.current) return null+ const outerElement = outerRef.current as HTMLDivElement+ const innerElement = innerRef.current as HTMLDivElement+ let x: any+ let y: any++ const { x: elX, y: elY, width, height } = outerElement.getBoundingClientRect()+ x = event.clientX - elX+ y = event.clientY - elY+ const isActive = x > -15 && x < width + 15 && y > -15 && y < height + 15+ const activeGlow = isActive+ ? `radial-gradient(65rem circle at ${x}px ${y}px, var(--colors-brand8), transparent), `+ : ''+ outerElement.style.background = isActive ? `var(--colors-brand9)` : `var(--colors-scale3)`+ outerElement.style.backgroundImage = `+ ${activeGlow}radial-gradient(30rem circle at ${x}px ${y}px, var(--colors-scale9), var(--colors-scale6))`++ innerElement.style.backgroundImage = isActive+ ? `radial-gradient(7rem circle at ${x}px ${y}px, var(--colors-scale5), transparent), radial-gradient(20rem circle at ${x}px ${y}px, var(--colors-scale4), transparent)`+ : ''+ }++ useEffect(() => {+ if (typeof window === 'undefined') return++ window.addEventListener('mousemove', handleGlow)+ return () => {+ window.removeEventListener('mousemove', handleGlow)+ }+ }, [])++ return (+ <div+ ref={outerRef}+ className={[+ 'relative rounded-xl bg-slate-400 from-slate-800 to-slate-800 p-px transition-all shadow-md',+ outerClassName,+ ].join(' ')}+ >+ <div+ className={[+ 'relative rounded-xl bg-scale-300 overflow-hidden transition-all flex flex-col text-slate-1100 lg:items-center lg:text-center',+ innerClassName,+ ].join(' ')}+ >+ <div className="relative z-10 w-full h-full">{children}</div>+ <div ref={innerRef} className="absolute z-0 inset-0 w-full h-full" />+ </div>+ </div>+ )+}++export default ShinyBox