mirror of
https://github.com/shadcn-ui/taxonomy
synced 2026-05-24 01:38:28 +00:00
added aurora background
This commit is contained in:
parent
a6485adf73
commit
7c762b9fbe
7 changed files with 137 additions and 26 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import Link from "next/link"
|
||||
|
||||
import { AuroraBackground } from "@/components/ui/aurora-background"
|
||||
import { marketingConfig } from "@/config/marketing"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { buttonVariants } from "@/components/ui/button"
|
||||
|
|
@ -14,25 +14,27 @@ export default async function MarketingLayout({
|
|||
children,
|
||||
}: MarketingLayoutProps) {
|
||||
return (
|
||||
<div className="flex min-h-screen flex-col">
|
||||
<header className="container z-40 bg-background">
|
||||
<div className="flex h-20 items-center justify-between py-6">
|
||||
<MainNav items={marketingConfig.mainNav} />
|
||||
<nav>
|
||||
<Link
|
||||
href="/login"
|
||||
className={cn(
|
||||
buttonVariants({ variant: "secondary", size: "sm" }),
|
||||
"px-4"
|
||||
)}
|
||||
>
|
||||
Login
|
||||
</Link>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
<main className="flex-1">{children}</main>
|
||||
<SiteFooter />
|
||||
</div>
|
||||
<AuroraBackground>
|
||||
<div className="flex min-h-screen flex-col">
|
||||
<header className="container z-40 relative">
|
||||
<div className="flex h-20 items-center justify-between py-6">
|
||||
<MainNav items={marketingConfig.mainNav} />
|
||||
<nav>
|
||||
<Link
|
||||
href="/login"
|
||||
className={cn(
|
||||
buttonVariants({ variant: "secondary", size: "sm" }),
|
||||
"px-4 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-colors"
|
||||
)}
|
||||
>
|
||||
Login
|
||||
</Link>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
<main className="flex-1 relative z-10">{children}</main>
|
||||
<SiteFooter className="relative z-10" />
|
||||
</div>
|
||||
</AuroraBackground>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,9 @@ import { env } from "@/env.mjs"
|
|||
import { siteConfig } from "@/config/site"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { buttonVariants } from "@/components/ui/button"
|
||||
import { AuroraBackground } from "@/components/ui/aurora-background"
|
||||
|
||||
|
||||
|
||||
async function getGitHubStars(): Promise<string | null> {
|
||||
try {
|
||||
|
|
@ -63,7 +66,7 @@ export default async function IndexPage() {
|
|||
</section>
|
||||
<section
|
||||
id="features"
|
||||
className="container space-y-6 bg-slate-50 py-8 dark:bg-transparent md:py-12 lg:py-24"
|
||||
className="container space-y-6 py-8 dark:bg-transparent md:py-12 lg:py-24"
|
||||
>
|
||||
<div className="mx-auto flex max-w-[58rem] flex-col items-center space-y-4 text-center">
|
||||
<h2 className="font-heading text-3xl leading-[1.1] sm:text-3xl md:text-6xl">
|
||||
|
|
@ -214,6 +217,6 @@ export default async function IndexPage() {
|
|||
)}
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
54
components/ui/aurora-background.tsx
Normal file
54
components/ui/aurora-background.tsx
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
"use client";
|
||||
import { cn } from "@/lib/utils";
|
||||
import React, { ReactNode } from "react";
|
||||
|
||||
interface AuroraBackgroundProps extends React.HTMLProps<HTMLDivElement> {
|
||||
children: ReactNode;
|
||||
showRadialGradient?: boolean;
|
||||
}
|
||||
|
||||
export const AuroraBackground = ({
|
||||
className,
|
||||
children,
|
||||
showRadialGradient = true,
|
||||
...props
|
||||
}: AuroraBackgroundProps) => {
|
||||
return (
|
||||
<main>
|
||||
<div
|
||||
className={cn(
|
||||
"relative flex flex-col h-[100vh] items-center justify-center bg-zinc-50 dark:bg-zinc-900 text-slate-950 transition-bg",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<div className="absolute inset-0 overflow-hidden">
|
||||
<div
|
||||
// I'm sorry but this is what peak developer performance looks like // trigger warning
|
||||
className={cn(
|
||||
`
|
||||
[--white-gradient:repeating-linear-gradient(100deg,var(--white)_0%,var(--white)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--white)_16%)]
|
||||
[--dark-gradient:repeating-linear-gradient(100deg,var(--black)_0%,var(--black)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--black)_16%)]
|
||||
[--aurora:repeating-linear-gradient(100deg,var(--blue-500)_10%,var(--indigo-300)_15%,var(--blue-300)_20%,var(--violet-200)_25%,var(--blue-400)_30%)]
|
||||
[background-image:var(--white-gradient),var(--aurora)]
|
||||
dark:[background-image:var(--dark-gradient),var(--aurora)]
|
||||
[background-size:300%,_200%]
|
||||
[background-position:50%_50%,50%_50%]
|
||||
filter blur-[10px] invert dark:invert-0
|
||||
after:content-[""] after:absolute after:inset-0 after:[background-image:var(--white-gradient),var(--aurora)]
|
||||
after:dark:[background-image:var(--dark-gradient),var(--aurora)]
|
||||
after:[background-size:200%,_100%]
|
||||
after:animate-aurora after:[background-attachment:fixed] after:mix-blend-difference
|
||||
pointer-events-none
|
||||
absolute -inset-[10px] opacity-50 will-change-transform`,
|
||||
|
||||
showRadialGradient &&
|
||||
`[mask-image:radial-gradient(ellipse_at_100%_0%,black_10%,var(--transparent)_70%)]`
|
||||
)}
|
||||
></div>
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
|
|
@ -19,3 +19,4 @@ export function formatDate(input: string | number): string {
|
|||
export function absoluteUrl(path: string) {
|
||||
return `${env.NEXT_PUBLIC_APP_URL}${path}`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@
|
|||
"concurrently": "^8.0.1",
|
||||
"contentlayer": "^0.3.1",
|
||||
"date-fns": "^2.29.3",
|
||||
"framer-motion": "^11.3.21",
|
||||
"lucide-react": "^0.92.0",
|
||||
"next": "13.3.2-canary.13",
|
||||
"next-auth": "4.22.1",
|
||||
|
|
|
|||
|
|
@ -161,6 +161,9 @@ importers:
|
|||
date-fns:
|
||||
specifier: ^2.29.3
|
||||
version: 2.29.3
|
||||
framer-motion:
|
||||
specifier: ^11.3.21
|
||||
version: 11.3.21(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
lucide-react:
|
||||
specifier: ^0.92.0
|
||||
version: 0.92.0(prop-types@15.8.1)(react@18.2.0)
|
||||
|
|
@ -2377,6 +2380,20 @@ packages:
|
|||
fraction.js@4.2.0:
|
||||
resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==}
|
||||
|
||||
framer-motion@11.3.21:
|
||||
resolution: {integrity: sha512-D+hfIsvzV8eL/iycld4K+tKlg2Q2LdwnrcBEohtGw3cG1AIuNYATbT5RUqIM1ndsAk+EfGhoSGf0UaiFodc5Tw==}
|
||||
peerDependencies:
|
||||
'@emotion/is-prop-valid': '*'
|
||||
react: ^18.0.0
|
||||
react-dom: ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@emotion/is-prop-valid':
|
||||
optional: true
|
||||
react:
|
||||
optional: true
|
||||
react-dom:
|
||||
optional: true
|
||||
|
||||
fs-constants@1.0.0:
|
||||
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
|
||||
|
||||
|
|
@ -7082,6 +7099,13 @@ snapshots:
|
|||
|
||||
fraction.js@4.2.0: {}
|
||||
|
||||
framer-motion@11.3.21(react-dom@18.2.0(react@18.2.0))(react@18.2.0):
|
||||
dependencies:
|
||||
tslib: 2.5.0
|
||||
optionalDependencies:
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0(react@18.2.0)
|
||||
|
||||
fs-constants@1.0.0: {}
|
||||
|
||||
fs-extra@11.1.1:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
const { fontFamily } = require("tailwindcss/defaultTheme")
|
||||
|
||||
const {
|
||||
default: flattenColorPalette,
|
||||
} = require("tailwindcss/lib/util/flattenColorPalette");
|
||||
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [
|
||||
|
|
@ -63,6 +67,14 @@ module.exports = {
|
|||
heading: ["var(--font-heading)", ...fontFamily.sans],
|
||||
},
|
||||
keyframes: {
|
||||
aurora: {
|
||||
from: {
|
||||
backgroundPosition: "50% 50%, 50% 50%",
|
||||
},
|
||||
to: {
|
||||
backgroundPosition: "350% 50%, 350% 50%",
|
||||
},
|
||||
},
|
||||
"accordion-down": {
|
||||
from: { height: 0 },
|
||||
to: { height: "var(--radix-accordion-content-height)" },
|
||||
|
|
@ -73,10 +85,24 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
animation: {
|
||||
aurora: "aurora 60s linear infinite",
|
||||
"accordion-down": "accordion-down 0.2s ease-out",
|
||||
"accordion-up": "accordion-up 0.2s ease-out",
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [require("tailwindcss-animate"), require("@tailwindcss/typography")],
|
||||
}
|
||||
plugins: [
|
||||
require("tailwindcss-animate"),
|
||||
require("@tailwindcss/typography"),
|
||||
function({ addBase, theme }) {
|
||||
let allColors = flattenColorPalette(theme("colors"));
|
||||
let newVars = Object.fromEntries(
|
||||
Object.entries(allColors).map(([key, val]) => [`--${key}`, val])
|
||||
);
|
||||
|
||||
addBase({
|
||||
":root": newVars,
|
||||
});
|
||||
}
|
||||
],
|
||||
};
|
||||
Loading…
Reference in a new issue