-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: dasein <[email protected]>
- Loading branch information
1 parent
7e9ac11
commit e03c627
Showing
57 changed files
with
1,122 additions
and
694 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
$animation-time: 2.3s; | ||
|
||
.dot { | ||
--size: 4px; | ||
|
||
display: inline-block; | ||
border-radius: 50%; | ||
opacity: 1; | ||
position: relative; | ||
|
||
width: var(--size); | ||
height: var(--size); | ||
|
||
--color-r: 0; | ||
--color-b: 0; | ||
--color-g: 0; | ||
|
||
&.color_ { | ||
&blue { | ||
--color-r: 31; | ||
--color-b: 203; | ||
--color-g: 225; | ||
} | ||
|
||
&red { | ||
--color-r: 255; | ||
--color-b: 92; | ||
--color-g: 0; | ||
} | ||
|
||
&green { | ||
--color-r: 122; | ||
--color-b: 250; | ||
--color-g: 161; | ||
} | ||
|
||
&purple { | ||
--color-r: 246; | ||
--color-b: 43; | ||
--color-g: 253; | ||
} | ||
|
||
&yellow { | ||
--color-r: 255; | ||
--color-g: 0; | ||
--color-b: 217; | ||
} | ||
} | ||
|
||
background-color: rgb(var(--color-r), var(--color-b), var(--color-g)); | ||
} | ||
|
||
.animation { | ||
transition: all 1s; | ||
|
||
animation: pulse $animation-time infinite alternate; | ||
} | ||
|
||
@keyframes pulse { | ||
0% { | ||
box-shadow: 0px 0px 0px 0px rgb(var(--color-r), | ||
var(--color-b), | ||
var(--color-g)); | ||
opacity: 0.2; | ||
} | ||
|
||
100% { | ||
box-shadow: 0px 0px 10px 2px rgb(var(--color-r), var(--color-b), var(--color-g)); | ||
} | ||
} |
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 { Meta, StoryObj } from '@storybook/react'; | ||
import Dot from './Dot'; | ||
|
||
const meta: Meta<typeof Dot> = { | ||
component: Dot, | ||
title: 'atoms/Dot', | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: '', | ||
}, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof Dot>; | ||
|
||
export const Main: Story = { | ||
args: { | ||
color: 'green', | ||
animation: true, | ||
}, | ||
}; |
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,39 @@ | ||
import cx from 'classnames'; | ||
import { useEffect, useRef } from 'react'; | ||
import styles from './Dot.module.scss'; | ||
|
||
export enum DotColors { | ||
blue = 'blue', | ||
green = 'green', | ||
red = 'red', | ||
purple = 'purple', | ||
yellow = 'yellow', | ||
} | ||
|
||
type Props = { | ||
color: DotColors | keyof typeof DotColors; | ||
className?: string; | ||
animation?: boolean; | ||
size?: number; | ||
}; | ||
|
||
function Dot({ color, className, animation, size = 4 }: Props) { | ||
const ref = useRef<HTMLLabelElement | null>(null); | ||
|
||
useEffect(() => { | ||
if (ref.current) { | ||
ref.current.style.setProperty('--size', `${size}px`); | ||
} | ||
}, [ref, size]); | ||
|
||
return ( | ||
<span | ||
ref={ref} | ||
className={cx(styles.dot, styles[`color_${color}`], className, { | ||
[styles.animation]: animation, | ||
})} | ||
/> | ||
); | ||
} | ||
|
||
export default Dot; |
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
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
Oops, something went wrong.