-
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.
* chore: atom -> atoms로 변경 * chore: styles.ts plop 수정 * feat: Spinner 추가
- Loading branch information
Showing
22 changed files
with
120 additions
and
17 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { ComponentPropsWithInnerRef } from "@customTypes/utilType"; | ||
import type { VariantProps } from "tailwind-variants"; | ||
import type { ComponentPropsWithInnerRef } from "@customTypes/utilType"; | ||
import { {{upperCamel name}}Variants } from "./{{upperCamel name}}.styles"; | ||
|
||
export type {{upperCamel name}}Props = ComponentPropsWithInnerRef<"{{tag}}">; | ||
export type {{upperCamel name}}Props = ComponentPropsWithInnerRef<"{{tag}}"> & VariantProps<typeof {{upperCamel name}}Variants>; |
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
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,28 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import Spinner from "./Spinner"; | ||
|
||
const meta = { | ||
title: "atoms/Spinner", | ||
component: Spinner, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof Spinner>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Spinner>; | ||
|
||
export const Default: Story = { | ||
render: () => <Spinner />, | ||
}; | ||
|
||
export const Size: Story = { | ||
render: () => ( | ||
<div className="flex gap-md"> | ||
<Spinner size="sm" /> | ||
<Spinner size="md" /> | ||
<Spinner size="lg" /> | ||
</div> | ||
), | ||
}; |
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,14 @@ | ||
import { tv } from "@utils/customTV"; | ||
|
||
export const SpinnerVariants = tv({ | ||
variants: { | ||
size: { | ||
sm: "w-[96rem]", | ||
md: "w-[120rem]", | ||
lg: "w-[148rem]", | ||
}, | ||
}, | ||
defaultVariants: { | ||
size: "md", | ||
}, | ||
}); |
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,36 @@ | ||
import { SpinnerVariants } from "./Spinner.styles"; | ||
import { SpinnerProps } from "./Spinner.types"; | ||
|
||
const Spinner = ({ size, className, ...props }: SpinnerProps) => { | ||
return ( | ||
<svg | ||
width="200" | ||
height="200" | ||
strokeWidth={"24px"} | ||
viewBox="0 0 400 400" | ||
className={SpinnerVariants({ size, className })} | ||
{...props} | ||
> | ||
<g className="animate-[spin_2s_linear_infinite] origin-center"> | ||
<path | ||
d="M132.826 264.259C145.449 277.631 161.754 286.959 179.679 291.064C197.604 295.168 216.344 293.866 233.528 287.32C250.713 280.775 265.571 269.28 276.222 254.291C286.874 239.301 292.842 221.489 293.371 203.108C293.9 184.727 288.966 166.601 279.194 151.024C269.422 135.447 255.25 123.117 238.47 115.594C221.69 108.071 203.057 105.693 184.925 108.76C166.794 111.827 149.979 120.202 136.608 132.826" | ||
strokeWidth="24" | ||
strokeLinecap="round" | ||
className="stroke-surface-on fill-none" | ||
/> | ||
<circle cx="108.425" cy="200.773" r="21.5577" fill="#FFD465" /> | ||
</g> | ||
<circle | ||
cx="200.425" | ||
cy="30.773" | ||
r="21.5577" | ||
className="fill-error origin-center animate-[spin_1.5s_ease-in-out_infinite]" | ||
/> | ||
<g className="origin-center animate-[spin_1.5s_infinite] ease-[cubic-bezier(0.95,0.05,0.795,0.035)] "> | ||
<circle cx="199.802" cy="30.15" r="12.9346" className="fill-primary" transform="rotate(25, 200, 200)" /> | ||
</g> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default Spinner; |
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,5 @@ | ||
import type { VariantProps } from "tailwind-variants"; | ||
import type { ComponentPropsWithInnerRef } from "@customTypes/utilType"; | ||
import { SpinnerVariants } from "./Spinner.styles"; | ||
|
||
export type SpinnerProps = ComponentPropsWithInnerRef<"svg"> & VariantProps<typeof SpinnerVariants>; |
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 { render } from "@testing-library/react"; | ||
import Spinner from "../Spinner"; | ||
|
||
describe("spinner", () => { | ||
// eslint-disable-next-line jest/expect-expect | ||
it("에러 없이 렌더링되어야 합니다.", () => { | ||
render(<Spinner />); | ||
}); | ||
}); |
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 Spinner from "./Spinner"; | ||
import { SpinnerVariants } from "./Spinner.styles"; | ||
import type { SpinnerProps } from "./Spinner.types"; | ||
|
||
export type { SpinnerProps }; | ||
|
||
export { SpinnerVariants }; | ||
|
||
export default Spinner |
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