Skip to content

Commit

Permalink
Apply comment suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
EMaksy committed Jun 9, 2023
1 parent 9aa3a9e commit 53efcae
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function ChecksResultOverview({
<span className="text-sm text-gray-600">
Checks execution running...
</span>
<Spinner size="xl" wrapperClassName="pt-12" />
<Spinner size="xl" className="pt-12" />
</div>
);
}
Expand Down
15 changes: 3 additions & 12 deletions assets/js/components/Spinner.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import React from 'react';
import { EOS_LOADING_ANIMATED } from 'eos-icons-react';

function Spinner({
centered = false,
wrapperClassName = '',
size = 'm',
spinnerColor = 'fill-jungle-green-500',
}) {
function Spinner({ className = '', size = 'm' }) {
return (
<div role="alert" aria-label="Loading" className={wrapperClassName}>
<EOS_LOADING_ANIMATED
size={size}
centered={centered}
className={spinnerColor}
/>
<div role="alert" aria-label="Loading" className={className}>
<EOS_LOADING_ANIMATED size={size} className={'fill-jungle-green-500'} />
</div>
);
}
Expand Down
16 changes: 1 addition & 15 deletions assets/js/components/Spinner.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ export default {

export const Default = {
argTypes: {
centered: {
control: 'boolean',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'false' },
},
},
wrapperClassName: {
className: {
control: 'text',
description: 'Add padding or margin',
table: {
Expand All @@ -31,12 +24,5 @@ export const Default = {
defaultValue: { summary: 'm' },
},
},
spinnerColor: {
description: 'Set tailwind fill color',
control: 'text',
table: {
type: { summary: 'string' },
},
},
},
};
5 changes: 1 addition & 4 deletions assets/js/components/Spinner.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ describe('Spinner', () => {
});

it('renders the spinner component with custom props', () => {
render(
<Spinner wrapperClassName="pt-12" size="xl" spinnerColor="fill-blue" />
);
render(<Spinner className="pt-12" size="xl" />);
const spinnerElement = screen.getByRole('alert');
expect(spinnerElement).toBeInTheDocument();
expect(spinnerElement).toHaveAttribute('aria-label', 'Loading');
expect(spinnerElement).toHaveClass('pt-12');
expect(spinnerElement.firstChild).toHaveClass('fill-blue');
expect(spinnerElement.firstChild).toHaveAttribute('width', '32');
});
});

0 comments on commit 53efcae

Please sign in to comment.