Skip to content

Commit 32dd58b

Browse files
authored
Merge pull request #747 from strapi/enhancement/status
Status: Add small variant
2 parents 61f3a7a + e0791d2 commit 32dd58b

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

packages/strapi-design-system/src/Status/Status.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,25 @@ const StatusWrapper = styled(Box)`
1919
}
2020
`;
2121

22-
export const Status = ({ variant, showBullet, children, ...props }) => {
22+
export const Status = ({ variant, showBullet, size, children, ...props }) => {
2323
const backgroundColor = `${variant}100`;
2424
const borderColor = `${variant}200`;
2525
const bulletColor = `${variant}600`;
2626
const textColor = `${variant}600`;
2727

28+
const paddingX = size === 'S' ? 2 : 5;
29+
const paddingY = size === 'S' ? 1 : 4;
30+
2831
return (
2932
<StatusWrapper
3033
borderColor={borderColor}
3134
textColor={textColor}
3235
background={backgroundColor}
3336
hasRadius
34-
paddingTop={4}
35-
paddingBottom={4}
36-
paddingLeft={5}
37-
paddingRight={5}
37+
paddingTop={paddingY}
38+
paddingBottom={paddingY}
39+
paddingLeft={paddingX}
40+
paddingRight={paddingX}
3841
{...props}
3942
>
4043
{showBullet ? (
@@ -51,6 +54,7 @@ export const Status = ({ variant, showBullet, children, ...props }) => {
5154

5255
Status.defaultProps = {
5356
showBullet: true,
57+
size: 'M',
5458
variant: 'primary',
5559
};
5660

@@ -63,6 +67,8 @@ Status.propTypes = {
6367
*/
6468
showBullet: PropTypes.bool, // TODO V2: remove prop and bullet
6569

70+
size: PropTypes.oneOf(['S', 'M']),
71+
6672
/**
6773
* Color variation
6874
*/

packages/strapi-design-system/src/Status/Status.stories.mdx

+21-2
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ Use a Status sparingly within forms to give an important visual indication. Stat
3535
<Canvas>
3636
<Story name="base">
3737
<Stack spacing={3}>
38-
<Status variant="success">
38+
<Status variant="success" showBullet={false}>
3939
<Typography>
4040
Hello world <Typography fontWeight="bold">thing happens</Typography>
4141
</Typography>
4242
</Status>
43-
<Status variant="secondary">
43+
<Status variant="secondary" showBullet={false}>
4444
<Typography>
4545
Hello world <Typography fontWeight="bold">thing happens</Typography>
4646
</Typography>
@@ -49,6 +49,25 @@ Use a Status sparingly within forms to give an important visual indication. Stat
4949
</Story>
5050
</Canvas>
5151

52+
53+
### Size
54+
55+
<Canvas>
56+
<Story name="size S">
57+
<Stack spacing={3}>
58+
<Status variant="success" size="S" showBullet={false}>
59+
<Typography fontWeight="bold" textColor="success700">Published</Typography>
60+
</Status>
61+
<Status variant="secondary" size="S" showBullet={false}>
62+
<Typography fontWeight="bold" textColor="secondary700">Draft</Typography>
63+
</Status>
64+
<Status variant="alternative" size="S" showBullet={false}>
65+
<Typography fontWeight="bold" textColor="alternative700">Updated</Typography>
66+
</Status>
67+
</Stack>
68+
</Story>
69+
</Canvas>
70+
5271
## Props
5372

5473
The Status component wraps all its children in the (Box)[https://design-system-git-main-strapijs.vercel.app/?path=/docs/design-system-technical-components-box--base] component, so you can pass all Box props to change its style.

0 commit comments

Comments
 (0)