Skip to content

Commit

Permalink
Revert "fix(plasma-core): add default uniqId for Spinner"
Browse files Browse the repository at this point in the history
This reverts commit ff10511.
  • Loading branch information
akhdrv authored Sep 15, 2023
1 parent 547934c commit 2fae022
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,4 @@ describe('plasma-core: Spinner', () => {
);
cy.matchImageSnapshot();
});

it('many colors', () => {
mount(
<CypressTestDecorator>
<Spin size={32} color="green" />
<PadMe />
<Spin size={32} color="blue" />
<PadMe />
<Spin size={32} color="red" />
</CypressTestDecorator>,
);
cy.matchImageSnapshot();
});
});
7 changes: 2 additions & 5 deletions packages/plasma-core/src/components/Spinner/Spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import styled, { keyframes, css } from 'styled-components';

import { accent } from '../../tokens';
import { useUniqId } from '../../hooks';

import { SpinnerSvg } from './SpinnerSvg';

Expand Down Expand Up @@ -49,13 +48,11 @@ const sizeFormatting = (size: number | string, deviceScale = 1): string => {
*/
export const Spinner: React.FC<SpinnerProps> = (props) => {
const { id, size = 56, color = accent, deviceScale, ...rest } = props;
const uniqId = useUniqId();
const innerId = id || uniqId;
const currentSize = sizeFormatting(size, deviceScale);

return (
<StyledRoot id={innerId} $size={currentSize} {...rest}>
<SpinnerSvg id={innerId} width={size} height={size} color={color} />
<StyledRoot id={id} $size={currentSize} {...rest}>
<SpinnerSvg id={id} width={size} height={size} color={color} />
</StyledRoot>
);
};

0 comments on commit 2fae022

Please sign in to comment.