Skip to content

Commit

Permalink
fix(Palette): fixed README.md for the landing (#1431)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruminat authored Mar 20, 2024
1 parent 27be674 commit c15f2e3
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions src/components/Palette/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import {Palette} from '@gravity-ui/uikit';

The `Palette` component is used display a grid of icons/emojis/reactions/symbols which you can select or unselect.

<!--/GITHUB_BLOCK-->

### Disabled state

You can disable every option with the `disabled` property. If you want to disable only a portion of options, you can change the `disabled` property of some of the `options` (`PaletteOption[]`).
Expand All @@ -20,24 +18,30 @@ You can disable every option with the `disabled` property. If you want to disabl
<ExampleBlock
code={`
const options: UIKit.PaletteOption[] = [
// disable a single item
{content: '😎', value: 'ID-cool', disabled: true},
const options: PaletteOption[] = [
{content: '😎', value: 'ID-cool'},
{content: '🥴', value: 'ID-woozy'},
];
// disable the first item
<Palette options={[{ ...options[0], disabled: true }, options[1]]} disabled={true} />
// or disable all of them
<UIKit.Palette options={options} disabled={true} />
<Palette options={options} disabled={true} />
`}
>
<UIKit.Palette
options={[
// disable a single item
{content: '😎', value: 'ID-cool', disabled: true},
{content: '🥴', value: 'ID-woozy'},
]}
/>
<UIKit.Palette
options={[
{content: '😎', value: 'ID-cool'},
{content: '🥴', value: 'ID-woozy'},
]}
disabled={true}
/>
</ExampleBlock>;
</ExampleBlock>
LANDING_BLOCK-->

Expand All @@ -63,15 +67,15 @@ To control the size of the `Palette`, use the `size` property. The default size
<ExampleBlock
code={`
const options: UIKit.PaletteOption[] = [
const options: PaletteOption[] = [
{content: '😎', value: 'ID-cool'},
{content: '🥴', value: 'ID-woozy'},
];
<UIKit.Palette options={options} size={"xs"} />
<UIKit.Palette options={options} size={"s"} /> // «s» is the default
<UIKit.Palette options={options} size={"m"} />
<UIKit.Palette options={options} size={"l"} />
<UIKit.Palette options={options} size={"xl"} />
<Palette options={options} size={"xs"} />
<Palette options={options} size={"s"} />
<Palette options={options} size={"m"} />
<Palette options={options} size={"l"} />
<Palette options={options} size={"xl"} />
`}
>
<UIKit.Palette
Expand Down Expand Up @@ -109,7 +113,7 @@ const options: UIKit.PaletteOption[] = [
]}
size="xl"
/>
</ExampleBlock>;
</ExampleBlock>
LANDING_BLOCK-->

Expand All @@ -121,7 +125,7 @@ const options: PaletteOption[] = [
{content: '🥴', value: 'ID-woozy'},
];
<Palette options={options} size={"xs"} />
<Palette options={options} size={"s"} /> // «s» is the default
<Palette options={options} size={"s"} />
<Palette options={options} size={"m"} />
<Palette options={options} size={"l"} />
<Palette options={options} size={"xl"} />
Expand All @@ -137,11 +141,11 @@ You can change the number of columns in the grid by changing the `columns` prope
<ExampleBlock
code={`
const options: UIKit.PaletteOption[] = [
const options: PaletteOption[] = [
{content: '😎', value: 'ID-cool'},
{content: '🥴', value: 'ID-woozy'},
];
<UIKit.Palette options={options} columns={1} />
<Palette options={options} columns={1} />
`}
>
<UIKit.Palette
Expand All @@ -151,7 +155,7 @@ const options: UIKit.PaletteOption[] = [
]}
columns={1}
/>
</ExampleBlock>;
</ExampleBlock>
LANDING_BLOCK-->

Expand All @@ -169,27 +173,27 @@ const options: PaletteOption[] = [

### Multiple

By default you can (un)select multiple option, but in case you want only one option to be selected, you can disable the `multiple` property.
By default you can (un)select multiple options, but in case you want only one option to be selected, you can disable the `multiple` property.

<!--LANDING_BLOCK
<ExampleBlock
code={`
const options: UIKit.PaletteOption[] = [
const options: PaletteOption[] = [
{content: '😎', value: 'ID-cool'},
{content: '🥴', value: 'ID-woozy'},
];
<UIKit.Palette options={options} multiple={false} />
<Palette options={options} multiple={false} />
`}
>
<UIKit.Palette
options={[
{content: '😎', value: 'ID-cool'},
{content: '🥴', value: 'ID-woozy'},
]}
columns={1}
multiple={false}
/>
</ExampleBlock>;
</ExampleBlock>
LANDING_BLOCK-->

Expand Down

0 comments on commit c15f2e3

Please sign in to comment.