Skip to content

Commit

Permalink
docs: Button with icon add label (#6697)
Browse files Browse the repository at this point in the history
- Fixes #4929
  • Loading branch information
SevereCloud authored and actions-user committed Mar 15, 2024
1 parent feec4f1 commit 095bf9e
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 20 deletions.
67 changes: 58 additions & 9 deletions packages/vkui/src/components/ButtonGroup/ButtonGroup.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Story = StoryObj<ButtonGroupProps>;

const ButtonText = 'Button';
const StretchedButtonText = 'Button (stretched)';
const ButtonWithIconLabel = 'Кнопка с иконкой';

export const Playground: Story = {
args: {
Expand All @@ -30,10 +31,32 @@ export const Playground: Story = {
<Button size="l" appearance="accent" stretched>
{StretchedButtonText}
</Button>
<Button size="m" appearance="accent" before={<Icon24Add />} />
<Button size="m" appearance="accent" before={<Icon24Add />} stretched />
<Button size="s" appearance="accent" before={<Icon16Add />} />
<Button size="s" appearance="accent" before={<Icon16Add />} stretched />
<Button
size="m"
appearance="accent"
before={<Icon24Add />}
aria-label={ButtonWithIconLabel}
/>
<Button
size="m"
appearance="accent"
before={<Icon24Add />}
aria-label={ButtonWithIconLabel}
stretched
/>
<Button
size="s"
appearance="accent"
before={<Icon16Add />}
aria-label={ButtonWithIconLabel}
/>
<Button
size="s"
appearance="accent"
before={<Icon16Add />}
aria-label={ButtonWithIconLabel}
stretched
/>
</>
),
},
Expand All @@ -53,21 +76,36 @@ export const NestedButtonGroup: Story = {
<Button size="l" appearance="accent" stretched>
{StretchedButtonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={ButtonWithIconLabel}
/>
</ButtonGroup>

<ButtonGroup mode="horizontal" gap="m" stretched style={ButtonGroupHighlightStyles}>
<Button size="l" appearance="accent">
{ButtonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={ButtonWithIconLabel}
/>
</ButtonGroup>

<ButtonGroup mode="horizontal" gap="m" stretched={false} style={ButtonGroupHighlightStyles}>
<Button size="l" appearance="accent">
{ButtonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={ButtonWithIconLabel}
/>
</ButtonGroup>

<ButtonGroup mode="horizontal" gap="m" stretched style={ButtonGroupHighlightStyles}>
Expand All @@ -86,9 +124,20 @@ export const NestedButtonGroup: Story = {
<Button size="l" appearance="accent" stretched>
{StretchedButtonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} stretched />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={ButtonWithIconLabel}
stretched
/>
<ButtonGroup mode="horizontal" stretched style={ButtonGroupHighlightStyles}>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={ButtonWithIconLabel}
/>
<Button size="l" appearance="accent" stretched>
{StretchedButtonText}
</Button>
Expand Down
74 changes: 64 additions & 10 deletions packages/vkui/src/components/ButtonGroup/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ const ExampleUseCases = () => {

const buttonText = 'Button';
const stretchedButtonText = 'Button (stretched)';
const buttonWithIconLabel = 'Кнопка с иконкой';

const buttonGroupHighlightStyles = {
border: '2px dotted tomato',
Expand Down Expand Up @@ -179,8 +180,19 @@ const ExampleBase = () => {
<Button size="l" appearance="accent" stretched>
{stretchedButtonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button size="l" appearance="accent" before={<Icon24Add />} stretched />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={buttonWithIconLabel}
/>
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={buttonWithIconLabel}
stretched
/>
</ButtonGroup>
</Div>
<FormItem>
Expand Down Expand Up @@ -237,14 +249,24 @@ const ExampleNested = () => {
<Button size="l" appearance="accent" stretched>
{stretchedButtonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={buttonWithIconLabel}
/>
</ButtonGroup>

<ButtonGroup mode="horizontal" gap="m" stretched style={buttonGroupHighlightStyles}>
<Button size="l" appearance="accent">
{buttonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={buttonWithIconLabel}
/>
</ButtonGroup>

<ButtonGroup
Expand All @@ -256,7 +278,12 @@ const ExampleNested = () => {
<Button size="l" appearance="accent">
{buttonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={buttonWithIconLabel}
/>
</ButtonGroup>

<ButtonGroup mode="horizontal" gap="m" stretched style={buttonGroupHighlightStyles}>
Expand All @@ -274,9 +301,20 @@ const ExampleNested = () => {
<Button size="l" appearance="accent" stretched>
{stretchedButtonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} stretched />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={buttonWithIconLabel}
stretched
/>
<ButtonGroup mode="horizontal" stretched style={buttonGroupHighlightStyles}>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={buttonWithIconLabel}
/>
<Button size="l" appearance="accent" stretched>
{stretchedButtonText}
</Button>
Expand Down Expand Up @@ -312,15 +350,31 @@ const ExampleNested = () => {
<Button size="l" appearance="accent">
{buttonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={buttonWithIconLabel}
/>
</ButtonGroup>
<ButtonGroup mode="vertical" gap="m" stretched={false} style={buttonGroupHighlightStyles}>
<Button size="l" appearance="accent" stretched>
{stretchedButtonText}
</Button>
<Button size="l" appearance="accent" before={<Icon24Add />} stretched />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={buttonWithIconLabel}
stretched
/>
<ButtonGroup mode="horizontal" stretched style={buttonGroupHighlightStyles}>
<Button size="l" appearance="accent" before={<Icon24Add />} />
<Button
size="l"
appearance="accent"
before={<Icon24Add />}
aria-label={buttonWithIconLabel}
/>
<Button size="l" appearance="accent" stretched>
{stretchedButtonText}
</Button>
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/Popover/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const PopoverWithTriggerManual = () => {
content={({ onClose }) => (
<div style={{ display: 'flex', position: 'relative', width: 180, height: 100 }}>
<div style={{ position: 'absolute', top: 0, right: 0 }}>
<IconButton onClick={onClose}>
<IconButton label="Закрыть" onClick={onClose}>
<Icon16Clear />
</IconButton>
</div>
Expand Down

0 comments on commit 095bf9e

Please sign in to comment.