-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from ReoHakase/126/add-aurora
feat: ✨ (`/docs/[.....slug]`) Apply aurora effects to background of the `/docs` layout (#126)
- Loading branch information
Showing
4 changed files
with
148 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
apps/web/src/features/landingPage/components/Aurora/Aurora.story.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Aurora } from './Aurora'; | ||
// import { css } from 'styled-system/css'; | ||
|
||
type Story = StoryObj<typeof Aurora>; | ||
|
||
const meta: Meta<typeof Aurora> = { | ||
component: Aurora, | ||
tags: ['autodocs'], | ||
args: {}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: Story = {}; |
62 changes: 62 additions & 0 deletions
62
apps/web/src/features/landingPage/components/Aurora/Aurora.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react'; | ||
import type { ReactNode, ComponentPropsWithoutRef } from 'react'; | ||
import { css, cx } from 'styled-system/css'; | ||
|
||
export type AuroraProps = ComponentPropsWithoutRef<'div'>; | ||
|
||
export const Aurora = ({ className, ...props }: AuroraProps): ReactNode => ( | ||
<div | ||
className={cx( | ||
css({ | ||
pos: 'absolute', | ||
top: '0', | ||
right: '0', | ||
display: 'flex', | ||
flexDir: 'column', | ||
w: '100vw', | ||
h: '500px', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
transition: 'background-color 0.5s', | ||
overflow: 'hidden', | ||
}), | ||
className, | ||
)} | ||
{...props} | ||
> | ||
<div | ||
className={css({ | ||
pos: 'absolute', | ||
inset: '-10px', | ||
opacity: 0.3, | ||
pointerEvents: 'none', | ||
bgImage: { | ||
_light: | ||
'repeating-linear-gradient( 100deg, #fff 0%, #fff 7%, transparent 10%, transparent 12%, #fff 16% ), repeating-linear-gradient( 100deg, #60a5fa 10%, #e879f9 16%, #5eead4 22%, #60a5fa 30% )', | ||
_dark: | ||
'repeating-linear-gradient( 100deg, #000 0%, #000 7%, transparent 10%, transparent 12%, #000 16% ), repeating-linear-gradient( 100deg, #60a5fa 10%, #e879f9 16%, #5eead4 22%, #60a5fa 30% )', | ||
}, | ||
bgSize: '300%, 200%', | ||
bgPosition: '50% 50%, 50% 50%', | ||
animation: 'aurora 180s ease-in-out -70s infinite alternate', | ||
_light: { | ||
filter: 'blur(10px)', | ||
}, | ||
_dark: { | ||
filter: 'blur(10px)', | ||
}, | ||
maskImage: 'radial-gradient(ellipse at 100% 0%, token(colors.keyplate.1) 10%, transparent 70%)', | ||
'&::after': { | ||
content: '""', | ||
pos: 'absolute', | ||
inset: '-10px', | ||
bgImage: | ||
'repeating-linear-gradient( 100deg, #000 0%, #000 7%, transparent 10%, transparent 12%, #000 16% ), repeating-linear-gradient( 100deg, #60a5fa 10%, #e879f9 16%, #5eead4 22%, #60a5fa 30% )', | ||
bgSize: '200%, 100%', | ||
bgAttachment: 'fixed', | ||
mixBlendMode: 'overlay', | ||
}, | ||
})} | ||
/> | ||
</div> | ||
); |