-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(spinner): [EMU-6599] add spinner component
- Loading branch information
Showing
5 changed files
with
51 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Spinner, SpinnerProps } from '.'; | ||
|
||
const story = { | ||
title: 'JSX/Spinner', | ||
component: Spinner, | ||
argTypes: { | ||
size: { | ||
control: { type: 'select' }, | ||
defaultValue: 's', | ||
description: 'Property that allows to customize the size of the spinner.', | ||
}, | ||
}, | ||
}; | ||
|
||
export const SpinnerStory = ({ size }: SpinnerProps) => <Spinner size={size} />; | ||
|
||
SpinnerStory.storyName = 'Spinner'; | ||
|
||
export default story; |
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,11 @@ | ||
import { render, screen } from '../../util/testUtils'; | ||
|
||
import { Spinner } from '.'; | ||
|
||
describe('Spinner component', () => { | ||
it('Should render spinner', async () => { | ||
render(<Spinner></Spinner>); | ||
|
||
expect(screen.getByTestId('ds-spinner')).toBeInTheDocument(); | ||
}); | ||
}); |
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 classNames from 'classnames'; | ||
|
||
export interface SpinnerProps { | ||
size?: 's' | 'm' | 'l'; | ||
} | ||
|
||
const Spinner = ({ size = 's' }: SpinnerProps) => ( | ||
<div | ||
className={classNames('ds-spinner', `ds-spinner__${size}`)} | ||
data-testid="ds-spinner" | ||
></div> | ||
); | ||
|
||
export { 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