Skip to content

Commit

Permalink
fix: shape of progressbar and avatar (#939)
Browse files Browse the repository at this point in the history
There are some issues with borders set as % vs px.
  • Loading branch information
nataliepina authored Mar 7, 2023
1 parent 1867c52 commit 11e1f2d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
7 changes: 2 additions & 5 deletions packages/avatar/style.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import * as React from "react";
import { css } from "@emotion/css";
import {
borderRadiusLarge,
themeBgSecondary
} from "../design-tokens/build/js/designTokens";
import { themeBgSecondary } from "../design-tokens/build/js/designTokens";

export const avatarContainer = css`
background-color: ${themeBgSecondary};
border-radius: ${borderRadiusLarge};
border-radius: 25%;
overflow: hidden;
position: relative;
Expand Down
4 changes: 2 additions & 2 deletions packages/avatar/tests/__snapshots__/avatar.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`Avatar renders default 1`] = `
<DocumentFragment>
.emotion-0 {
background-color: var(--themeBgSecondary, #F7F8F9);
border-radius: 8px;
border-radius: 25%;
overflow: hidden;
position: relative;
height: 32px;
Expand Down Expand Up @@ -49,7 +49,7 @@ exports[`Avatar renders with a src, size, and label 1`] = `
<DocumentFragment>
.emotion-0 {
background-color: var(--themeBgSecondary, #F7F8F9);
border-radius: 8px;
border-radius: 25%;
overflow: hidden;
position: relative;
height: 64px;
Expand Down
13 changes: 9 additions & 4 deletions packages/progressbar/components/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export interface ProgressBarProps {
* Which size variant to use
*/
size?: ProgressBarSizes;
/**
* Human-readable selector used for writing tests
*/
"data-cy"?: string;
}

const ProgressBar = ({
Expand All @@ -49,14 +53,15 @@ const ProgressBar = ({
value,
size,
isProcessing,
isCondensedLayout
isCondensedLayout,
"data-cy": dataCy = "progressBar-chart"
}: ProgressBarProps) => {
const renderProgressBar = () => (
<svg
className={cx(progressBar(size), {
[progressBarStaged]: isProcessing
})}
data-cy="progressBar-chart"
data-cy={dataCy}
role="presentation"
>
{data.map((datum, i) => {
Expand Down Expand Up @@ -93,7 +98,7 @@ const ProgressBar = ({
) : null}
</Flex>
) : (
<React.Fragment>
<>
<SpacingBox side="bottom" spacingSize="xxs">
<Flex align="center" justify="flex-end" gutterSize="s">
{caption ? (
Expand All @@ -113,7 +118,7 @@ const ProgressBar = ({
</Flex>
</SpacingBox>
{renderProgressBar()}
</React.Fragment>
</>
);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/progressbar/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const stripeMotion = keyframes`

export const progressBar = size => css`
background-color: ${hexToRgbA(getCSSVarValue(themeBorder), 0.65)};
border-radius: ${borderRadiusCircle};
border-radius: 999px;
display: block;
height: ${size === ProgressBarSizes.LARGE ? "12px" : "6px"};
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ exports[`ProgressBar renders all sizes 1`] = `
.emotion-0 {
background-color: rgba(218,221,226,0.65);
border-radius: 50%;
border-radius: 999px;
display: block;
height: 12px;
width: 100%;
Expand Down Expand Up @@ -181,7 +181,7 @@ exports[`ProgressBar renders all sizes 2`] = `
.emotion-0 {
background-color: rgba(218,221,226,0.65);
border-radius: 50%;
border-radius: 999px;
display: block;
height: 6px;
width: 100%;
Expand Down Expand Up @@ -291,7 +291,7 @@ exports[`ProgressBar renders isProcessing 1`] = `
.emotion-0 {
background-color: rgba(218,221,226,0.65);
border-radius: 50%;
border-radius: 999px;
display: block;
height: 6px;
width: 100%;
Expand Down Expand Up @@ -463,7 +463,7 @@ exports[`ProgressBar renders with caption text and value text 1`] = `
</div>
.emotion-0 {
background-color: rgba(218,221,226,0.65);
border-radius: 50%;
border-radius: 999px;
display: block;
height: 6px;
width: 100%;
Expand Down Expand Up @@ -547,7 +547,7 @@ exports[`ProgressBar renders with multiple segments of data 1`] = `
</div>
.emotion-0 {
background-color: rgba(218,221,226,0.65);
border-radius: 50%;
border-radius: 999px;
display: block;
height: 6px;
width: 100%;
Expand Down Expand Up @@ -641,7 +641,7 @@ exports[`ProgressBar renders with one segment of data 1`] = `
</div>
.emotion-0 {
background-color: rgba(218,221,226,0.65);
border-radius: 50%;
border-radius: 999px;
display: block;
height: 6px;
width: 100%;
Expand Down

0 comments on commit 11e1f2d

Please sign in to comment.