Skip to content

Commit

Permalink
feat(docs): QUV-1018 Create in Storybook the case for TagGroup as legend
Browse files Browse the repository at this point in the history
  • Loading branch information
soslayando committed May 16, 2023
1 parent 233a021 commit 8d328f6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/components/Tag/StyledTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const StyledTag = styled.div<StyledTagProps>`
border-radius: ${cmpTokens.shape.borderRadius};
max-width: 100%;
height: ${cmpTokens.size.height[size]};
padding: 0 ${cmpTokens.space.padding.hor[size]};
padding: ${quiet ? '0' : `0 ${cmpTokens.space.padding.hor[size]}`};
background-color: ${bgColor};
${typoMixin({ bold: bold, theme, size })};
color: ${textColor};
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/TagGroup/StyledTagGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { StyledTagProps } from '../Tag/StyledTag';

export interface StyledTagGroupProps {
/** Position of the label text relative to the tags */
labelPosition: LabelPosition;
labelPosition?: LabelPosition;
}

export const StyledTagGroup = styled.div<StyledTagGroupProps>`
Expand Down
25 changes: 25 additions & 0 deletions packages/core/src/components/TagGroup/TagGroup.cases.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as React from 'react';
import { Meta, StoryObj } from '@storybook/react';

import { Tag, TagGroup } from '..';

const meta: Meta<typeof TagGroup> = {
title: 'Components/Core/Feedback/TagGroup/Cases',
component: TagGroup,
};

export default meta;
type Story = StoryObj<typeof TagGroup>;

export const AsLegend: Story = {
name: 'As legend',
render: () =>
(() => (
<TagGroup>
<Tag text="New alerts" colorScheme="success" quiet />
<Tag text="Warning alerts" colorScheme="warning" quiet />
<Tag text="Error alerts" colorScheme="error" quiet />
<Tag text="Not defined alerts" colorScheme="data-blue" quiet />
</TagGroup>
))(),
};
4 changes: 4 additions & 0 deletions packages/core/src/components/TagGroup/TagGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import { TagGroup } from '@devoinc/genesys-ui';

<Canvas of={Stories.Base} />

## As legend

<Canvas of={Stories.AsLegend} />

## Props

<ArgTypes of={Stories} />
2 changes: 1 addition & 1 deletion packages/core/src/components/TagGroup/TagGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface TagGroupProps
GlobalAttrProps,
GlobalAriaProps,
StyledTagGroupProps,
StyledTagGroupLabelProps {
Omit<StyledTagGroupLabelProps, 'labelPosition'> {
/** Polymorphic prop to create a different tag or styled component
* https://styled-components.com/docs/api#as-polymorphic-prop */
children: React.ReactElement<TagProps>[];
Expand Down

0 comments on commit 8d328f6

Please sign in to comment.