-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(design): introduce some usefull components (#20)
* feat(design): introduce some usefull components * build: remove useless dep * fix: code format * fix * fix code format
- Loading branch information
1 parent
e2a493d
commit e767e4f
Showing
32 changed files
with
1,717 additions
and
35 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
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
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,6 @@ | ||
import Landing from '@/components/Sections/Landing'; | ||
import type { FC } from 'react'; | ||
|
||
const Page: FC = () => <Landing />; | ||
|
||
export default Page; |
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,23 @@ | ||
.background { | ||
@apply absolute | ||
left-0 | ||
top-0 | ||
-z-10 | ||
size-full | ||
bg-[url('/static/background.svg')] | ||
bg-center | ||
bg-no-repeat; | ||
|
||
&::after { | ||
@apply absolute | ||
inset-0 | ||
m-auto | ||
aspect-square | ||
w-[300px] | ||
rounded-full | ||
bg-ether-400 | ||
blur-[120px] | ||
content-[''] | ||
dark:bg-ether-700; | ||
} | ||
} |
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,9 @@ | ||
import BluredBackground from './'; | ||
import type { Meta as MetaObj, StoryObj } from '@storybook/react'; | ||
|
||
type Story = StoryObj<typeof BluredBackground>; | ||
type Meta = MetaObj<typeof BluredBackground>; | ||
|
||
export const Default: Story = {}; | ||
|
||
export default { component: BluredBackground } as Meta; |
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,6 @@ | ||
import styles from './index.module.css'; | ||
import type { FC } from 'react'; | ||
|
||
const BluredBackground: FC = () => <div className={styles.background} />; | ||
|
||
export default BluredBackground; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.inputWrapper { | ||
@apply flex | ||
w-full | ||
flex-col | ||
gap-1.5; | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
.root { | ||
@apply m-6 | ||
w-fit | ||
max-w-80 | ||
rounded | ||
border | ||
border-gray-200 | ||
px-4 | ||
py-3 | ||
shadow-lg | ||
dark:border-gray-800; | ||
|
||
.message { | ||
@apply inline-flex | ||
items-center | ||
justify-center | ||
gap-2 | ||
font-medium; | ||
|
||
svg { | ||
@apply size-5; | ||
} | ||
} | ||
} | ||
|
||
.success { | ||
@apply border-green-200 | ||
bg-green-100 | ||
text-green-800 | ||
dark:border-green-600 | ||
dark:bg-green-800 | ||
dark:text-white; | ||
} | ||
|
||
.error { | ||
@apply border-red-200 | ||
bg-red-100 | ||
text-red-800 | ||
dark:border-red-600 | ||
dark:bg-red-800 | ||
dark:text-white; | ||
} | ||
|
||
.warning { | ||
@apply border-yellow-200 | ||
bg-yellow-100 | ||
text-yellow-800 | ||
dark:border-yellow-600 | ||
dark:bg-yellow-800 | ||
dark:text-white; | ||
} | ||
|
||
.info { | ||
@apply border-ether-200 | ||
bg-ether-100 | ||
text-ether-800 | ||
dark:border-ether-600 | ||
dark:bg-ether-800 | ||
dark:text-white; | ||
} |
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,59 @@ | ||
import { BellDotIcon } from 'lucide-react'; | ||
import Notification from '.'; | ||
import type { Meta as MetaObj, StoryObj } from '@storybook/react'; | ||
|
||
type Story = StoryObj<typeof Notification>; | ||
type Meta = MetaObj<typeof Notification>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
open: true, | ||
duration: 5000, | ||
children: 'OK, everything is fine!', | ||
}, | ||
}; | ||
|
||
export const TimedNotification: Story = { | ||
args: { | ||
duration: 5000, | ||
children: 'OK, everything is fine!', | ||
}, | ||
}; | ||
|
||
export const WithJSX: Story = { | ||
args: { | ||
open: true, | ||
children: ( | ||
<> | ||
<BellDotIcon /> | ||
OK, everything is fine! | ||
</> | ||
), | ||
}, | ||
}; | ||
|
||
export const Success: Story = { | ||
args: { | ||
open: true, | ||
variant: 'success', | ||
children: 'OK, everything is fine!', | ||
}, | ||
}; | ||
|
||
export const Error: Story = { | ||
args: { | ||
open: true, | ||
variant: 'error', | ||
children: 'Something went wrong!', | ||
}, | ||
}; | ||
|
||
export const Warning: Story = { | ||
args: { | ||
open: true, | ||
variant: 'warning', | ||
children: 'Be careful!', | ||
}, | ||
}; | ||
|
||
export default { component: Notification } as Meta; |
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,35 @@ | ||
import * as ToastPrimitive from '@radix-ui/react-toast'; | ||
import classNames from 'classnames'; | ||
import styles from './index.module.css'; | ||
import type { FC, PropsWithChildren } from 'react'; | ||
|
||
type ToastProps = PropsWithChildren<{ | ||
variant?: 'success' | 'error' | 'warning' | 'info'; | ||
open?: boolean; | ||
duration?: number; | ||
onChange?: (value: boolean) => void; | ||
className?: string; | ||
}>; | ||
|
||
const Toast: FC<ToastProps> = ({ | ||
variant = 'info', | ||
open, | ||
// 2s duration | ||
duration = 2000, | ||
onChange, | ||
children, | ||
className, | ||
}) => ( | ||
<ToastPrimitive.Root | ||
open={open} | ||
duration={duration} | ||
onOpenChange={onChange} | ||
className={classNames(styles.root, styles[variant], className)} | ||
> | ||
<ToastPrimitive.Title className={styles.message}> | ||
{children} | ||
</ToastPrimitive.Title> | ||
</ToastPrimitive.Root> | ||
); | ||
|
||
export default Toast; |
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,23 @@ | ||
import type { FC, SVGProps } from 'react'; | ||
|
||
const Apple: FC<SVGProps<SVGSVGElement>> = props => ( | ||
<svg | ||
width="32" | ||
height="32" | ||
viewBox="0 0 32 32" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
{...props} | ||
> | ||
<path | ||
d="M30 16c0 7.728-6.265 14-14 14S2 23.728 2 16C2 8.265 8.265 2 16 2s14 6.265 14 14Z" | ||
fill="#283544" | ||
/> | ||
<path | ||
d="M22.562 12.457c-.076.045-1.895.986-1.895 3.07.086 2.38 2.295 3.213 2.333 3.213-.038.045-.334 1.136-1.21 2.28-.694.986-1.466 1.98-2.637 1.98-1.114 0-1.514-.657-2.8-.657-1.381 0-1.772.657-2.829.657-1.171 0-2-1.047-2.733-2.023-.952-1.278-1.761-3.284-1.79-5.21-.02-1.02.19-2.023.724-2.875.752-1.19 2.095-1.997 3.561-2.023 1.124-.036 2.124.719 2.81.719.657 0 1.885-.72 3.275-.72.6.001 2.2.17 3.191 1.59Zm-6.561-1.792c-.2-.932.352-1.864.866-2.458.657-.72 1.695-1.207 2.59-1.207a3.334 3.334 0 0 1-.952 2.511c-.58.72-1.58 1.26-2.504 1.154Z" | ||
fill="#fff" | ||
/> | ||
</svg> | ||
); | ||
|
||
export default Apple; |
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,22 @@ | ||
import type { FC, SVGProps } from 'react'; | ||
|
||
const Generic: FC<SVGProps<SVGSVGElement>> = props => ( | ||
<svg | ||
width="32" | ||
height="32" | ||
viewBox="0 0 32 32" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
{...props} | ||
> | ||
<path | ||
d="M16 29.333c7.364 0 13.333-5.97 13.333-13.333 0-7.364-5.97-13.334-13.333-13.334C8.636 2.666 2.667 8.636 2.667 16S8.637 29.333 16 29.333Z" | ||
stroke="#000" | ||
strokeWidth="2.667" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</svg> | ||
); | ||
|
||
export default Generic; |
Oops, something went wrong.