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

docs: Button with icon add label #6697

Merged
merged 2 commits into from
Mar 15, 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
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