Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): spinner 컴포넌트 개발 및 스토리북 작성 #11

Merged
merged 5 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions packages/ui/src/Spinner/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { cva } from 'class-variance-authority';
import { cn } from '..';
lheesung marked this conversation as resolved.
Show resolved Hide resolved

type SpinnerProps = {
size?: 'lg' | 'md' | 'sm';
};

const SpinnerVariants = cva(
'animate-spin rounded-full border-8 border-solid border-gray-500 border-t-primary',
{
variants: {
size: {
lg: 'w-16 h-16',
md: 'w-12 h-12',
sm: 'w-8 h-8',
},
},
defaultVariants: {
size: 'md',
},
}
);

const Spinner = ({ size = 'md' }: SpinnerProps) => {
return <div className={cn(SpinnerVariants({ size }))} />;
lheesung marked this conversation as resolved.
Show resolved Hide resolved
};

export default Spinner;
3 changes: 2 additions & 1 deletion packages/ui/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as Flex } from './Flex';
export * from './utils';
export { default as Spinner } from './Spinner';
export { default as WarningAlertModal } from './WarningAlertModal';
export * from './utils';
Loading
Loading