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(LoadingIndicator): update stroke width in Button #1964

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions src/components/Button/Button-v2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import clsx from 'clsx';
import React, { forwardRef } from 'react';
import type { Size } from '../../util/variant-types';
import { IconV2 as Icon, type IconNameV2 as IconName } from '../Icon';
import LoadingIndicator from '../LoadingIndicator';
import { LoadingIndicatorV2 as LoadingIndicator } from '../LoadingIndicator';

import styles from './Button-v2.module.css';

Expand Down Expand Up @@ -157,7 +157,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonV2Props>(
)}
</span>
{isLoading && (
<LoadingIndicator className={styles['button__loader']} size="sm" />
<LoadingIndicator className={styles['button__loader']} size="xs" />
)}
</button>
);
Expand Down
30 changes: 15 additions & 15 deletions src/components/Button/__snapshots__/Button-v2.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,10 @@ exports[`<Button /> (v2) LoadingStates story renders snapshot 1`] = `
>
<svg
data-testid="oval-svg"
height="24"
height="16"
stroke="transparent"
viewBox="-20 -20 42 42"
width="24"
viewBox="-22 -22 46 46"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<g
Expand All @@ -318,7 +318,7 @@ exports[`<Button /> (v2) LoadingStates story renders snapshot 1`] = `
>
<g
data-testid="oval-secondary-group"
stroke-width="2"
stroke-width="4"
transform="translate(1 1)"
>
<circle
Expand All @@ -327,7 +327,7 @@ exports[`<Button /> (v2) LoadingStates story renders snapshot 1`] = `
r="20"
stroke="transparent"
stroke-opacity=".5"
stroke-width="2"
stroke-width="4"
/>
<path
d="M20 0c0-9.94-8.06-20-20-20"
Expand Down Expand Up @@ -364,10 +364,10 @@ exports[`<Button /> (v2) LoadingStates story renders snapshot 1`] = `
>
<svg
data-testid="oval-svg"
height="24"
height="16"
stroke="transparent"
viewBox="-20 -20 42 42"
width="24"
viewBox="-22 -22 46 46"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<g
Expand All @@ -376,7 +376,7 @@ exports[`<Button /> (v2) LoadingStates story renders snapshot 1`] = `
>
<g
data-testid="oval-secondary-group"
stroke-width="2"
stroke-width="4"
transform="translate(1 1)"
>
<circle
Expand All @@ -385,7 +385,7 @@ exports[`<Button /> (v2) LoadingStates story renders snapshot 1`] = `
r="20"
stroke="transparent"
stroke-opacity=".5"
stroke-width="2"
stroke-width="4"
/>
<path
d="M20 0c0-9.94-8.06-20-20-20"
Expand Down Expand Up @@ -422,10 +422,10 @@ exports[`<Button /> (v2) LoadingStates story renders snapshot 1`] = `
>
<svg
data-testid="oval-svg"
height="24"
height="16"
stroke="transparent"
viewBox="-20 -20 42 42"
width="24"
viewBox="-22 -22 46 46"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<g
Expand All @@ -434,7 +434,7 @@ exports[`<Button /> (v2) LoadingStates story renders snapshot 1`] = `
>
<g
data-testid="oval-secondary-group"
stroke-width="2"
stroke-width="4"
transform="translate(1 1)"
>
<circle
Expand All @@ -443,7 +443,7 @@ exports[`<Button /> (v2) LoadingStates story renders snapshot 1`] = `
r="20"
stroke="transparent"
stroke-opacity=".5"
stroke-width="2"
stroke-width="4"
/>
<path
d="M20 0c0-9.94-8.06-20-20-20"
Expand Down
14 changes: 7 additions & 7 deletions src/components/LoadingIndicator/LoadingIndicator-v2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ const loaderSize = {

// Given a loader size, the stroke widths can change
const loaderStrokeSize = {
xs: 2,
sm: 2,
md: 3,
xs: 4,
sm: 4,
md: 4,
lg: 4,
};

// The viewport changes based on adjustments to handle the stroke width
const loaderViewportSize = {
xs: '-20 -20 42 42',
sm: '-20 -20 42 42',
md: '-20.5 -20.5 43 43',
lg: '-21 -21 44 44',
xs: '-22 -22 46 46',
sm: '-22 -22 46 46',
md: '-22 -22 46 46',
lg: '-22 -22 46 46',
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`<LoadingIndicator /> (v2) Default story renders snapshot 1`] = `
data-testid="oval-svg"
height="40"
stroke="transparent"
viewBox="-20.5 -20.5 43 43"
viewBox="-22 -22 46 46"
width="40"
xmlns="http://www.w3.org/2000/svg"
>
Expand All @@ -22,7 +22,7 @@ exports[`<LoadingIndicator /> (v2) Default story renders snapshot 1`] = `
>
<g
data-testid="oval-secondary-group"
stroke-width="3"
stroke-width="4"
transform="translate(1 1)"
>
<circle
Expand All @@ -31,7 +31,7 @@ exports[`<LoadingIndicator /> (v2) Default story renders snapshot 1`] = `
r="20"
stroke="transparent"
stroke-opacity=".5"
stroke-width="3"
stroke-width="4"
/>
<path
d="M20 0c0-9.94-8.06-20-20-20"
Expand Down Expand Up @@ -63,7 +63,7 @@ exports[`<LoadingIndicator /> (v2) ExtraSmall story renders snapshot 1`] = `
data-testid="oval-svg"
height="16"
stroke="transparent"
viewBox="-20 -20 42 42"
viewBox="-22 -22 46 46"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
Expand All @@ -73,7 +73,7 @@ exports[`<LoadingIndicator /> (v2) ExtraSmall story renders snapshot 1`] = `
>
<g
data-testid="oval-secondary-group"
stroke-width="2"
stroke-width="4"
transform="translate(1 1)"
>
<circle
Expand All @@ -82,7 +82,7 @@ exports[`<LoadingIndicator /> (v2) ExtraSmall story renders snapshot 1`] = `
r="20"
stroke="transparent"
stroke-opacity=".5"
stroke-width="2"
stroke-width="4"
/>
<path
d="M20 0c0-9.94-8.06-20-20-20"
Expand Down Expand Up @@ -114,7 +114,7 @@ exports[`<LoadingIndicator /> (v2) Invisible story renders snapshot 1`] = `
data-testid="oval-svg"
height="40"
stroke="transparent"
viewBox="-20.5 -20.5 43 43"
viewBox="-22 -22 46 46"
width="40"
xmlns="http://www.w3.org/2000/svg"
>
Expand All @@ -124,7 +124,7 @@ exports[`<LoadingIndicator /> (v2) Invisible story renders snapshot 1`] = `
>
<g
data-testid="oval-secondary-group"
stroke-width="3"
stroke-width="4"
transform="translate(1 1)"
>
<circle
Expand All @@ -133,7 +133,7 @@ exports[`<LoadingIndicator /> (v2) Invisible story renders snapshot 1`] = `
r="20"
stroke="transparent"
stroke-opacity=".5"
stroke-width="3"
stroke-width="4"
/>
<path
d="M20 0c0-9.94-8.06-20-20-20"
Expand Down Expand Up @@ -165,7 +165,7 @@ exports[`<LoadingIndicator /> (v2) Large story renders snapshot 1`] = `
data-testid="oval-svg"
height="56"
stroke="transparent"
viewBox="-21 -21 44 44"
viewBox="-22 -22 46 46"
width="56"
xmlns="http://www.w3.org/2000/svg"
>
Expand Down Expand Up @@ -216,7 +216,7 @@ exports[`<LoadingIndicator /> (v2) Medium story renders snapshot 1`] = `
data-testid="oval-svg"
height="40"
stroke="transparent"
viewBox="-20.5 -20.5 43 43"
viewBox="-22 -22 46 46"
width="40"
xmlns="http://www.w3.org/2000/svg"
>
Expand All @@ -226,7 +226,7 @@ exports[`<LoadingIndicator /> (v2) Medium story renders snapshot 1`] = `
>
<g
data-testid="oval-secondary-group"
stroke-width="3"
stroke-width="4"
transform="translate(1 1)"
>
<circle
Expand All @@ -235,7 +235,7 @@ exports[`<LoadingIndicator /> (v2) Medium story renders snapshot 1`] = `
r="20"
stroke="transparent"
stroke-opacity=".5"
stroke-width="3"
stroke-width="4"
/>
<path
d="M20 0c0-9.94-8.06-20-20-20"
Expand Down Expand Up @@ -267,7 +267,7 @@ exports[`<LoadingIndicator /> (v2) Small story renders snapshot 1`] = `
data-testid="oval-svg"
height="24"
stroke="transparent"
viewBox="-20 -20 42 42"
viewBox="-22 -22 46 46"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
Expand All @@ -277,7 +277,7 @@ exports[`<LoadingIndicator /> (v2) Small story renders snapshot 1`] = `
>
<g
data-testid="oval-secondary-group"
stroke-width="2"
stroke-width="4"
transform="translate(1 1)"
>
<circle
Expand All @@ -286,7 +286,7 @@ exports[`<LoadingIndicator /> (v2) Small story renders snapshot 1`] = `
r="20"
stroke="transparent"
stroke-opacity=".5"
stroke-width="2"
stroke-width="4"
/>
<path
d="M20 0c0-9.94-8.06-20-20-20"
Expand Down Expand Up @@ -318,7 +318,7 @@ exports[`<LoadingIndicator /> (v2) WithAriaLabel story renders snapshot 1`] = `
data-testid="oval-svg"
height="40"
stroke="transparent"
viewBox="-20.5 -20.5 43 43"
viewBox="-22 -22 46 46"
width="40"
xmlns="http://www.w3.org/2000/svg"
>
Expand All @@ -328,7 +328,7 @@ exports[`<LoadingIndicator /> (v2) WithAriaLabel story renders snapshot 1`] = `
>
<g
data-testid="oval-secondary-group"
stroke-width="3"
stroke-width="4"
transform="translate(1 1)"
>
<circle
Expand All @@ -337,7 +337,7 @@ exports[`<LoadingIndicator /> (v2) WithAriaLabel story renders snapshot 1`] = `
r="20"
stroke="transparent"
stroke-opacity=".5"
stroke-width="3"
stroke-width="4"
/>
<path
d="M20 0c0-9.94-8.06-20-20-20"
Expand Down
Loading