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

UI: Remove 'left' property from TooltipLinkList and Link components #26324

Merged
merged 3 commits into from Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 40 additions & 0 deletions MIGRATION.md
Expand Up @@ -64,6 +64,7 @@
- [Removed `passArgsFirst` option](#removed-passargsfirst-option)
- [Methods and properties from AddonStore](#methods-and-properties-from-addonstore)
- [Methods and properties from PreviewAPI](#methods-and-properties-from-previewapi)
- [Removals in @storybook/components](#removals-in-storybookcomponents)
- [Removals in @storybook/types](#removals-in-storybooktypes)
- [--use-npm flag in storybook CLI](#--use-npm-flag-in-storybook-cli)
- [hideNoControlsWarning parameter from addon controls](#hidenocontrolswarning-parameter-from-addon-controls)
Expand Down Expand Up @@ -1040,6 +1041,45 @@ The following exports from `@storybook/preview-api` are now removed:

Please file an issue if you need these APIs.

#### Removals in @storybook/components

The `TooltipLinkList` component accepts a `links` property where, for each link, a `left` property could be passed. The left property is now removed in Storybook 8 and beyond. Use `icon` instead. The side-effect is that the `left` property is now removed from the `Link` component. The Link component is used to define `globalTypes` in the `preview.js` file, among other places:
valentinpalkovic marked this conversation as resolved.
Show resolved Hide resolved

```diff
// Replace your-framework with the framework you are using (e.g., react, vue3)
import { Preview } from '@storybook/your-framework';

const preview: Preview = {
globalTypes: {
locale: {
description: 'Internationalization locale',
defaultValue: 'en',
toolbar: {
icon: 'globe',
items: [
{
value: 'en',
right: '🇺🇸',
- left: '$'
+ icon: 'facehappy'
title: 'English'
},
{ value: 'fr', right: '🇫🇷', title: 'Français' },
{ value: 'es', right: '🇪🇸', title: 'Español' },
{ value: 'zh', right: '🇨🇳', title: '中文' },
{ value: 'kr', right: '🇰🇷', title: '한국어' },
],
},
},
},
};

export default preview;
```

The icon property only supports a limited set of icons, which are defined here:
https://storybook.js.org/docs/8.0/faq#what-icons-are-available-for-my-toolbar-or-my-addon

#### Removals in @storybook/types

The following exports from `@storybook/types` are now removed:
Expand Down
1 change: 0 additions & 1 deletion code/addons/toolbars/src/types.ts
Expand Up @@ -15,7 +15,6 @@ export type ToolbarShortcuts = Record<ToolbarShortcutType, ToolbarShortcutConfig
export interface ToolbarItem {
value?: string;
icon?: IconsProps['icon'];
left?: string;
right?: string;
title?: string;
hideIcon?: boolean;
Expand Down
1 change: 0 additions & 1 deletion docs/essentials/toolbars-and-globals.md
Expand Up @@ -148,7 +148,6 @@ Here's a list of the configuration options available.
| --------- | :----: | :-------------------------------------------------------------: | :------: |
| **value** | String | The string value of the menu that gets set in the globals | Yes |
| **title** | String | The main text of the title | Yes |
| **left** | String | A string that gets shown on the left side of the menu | No |
| **right** | String | A string that gets displayed on the right side of the menu | No |
| **icon** | String | An icon that gets shown in the toolbar if this item is selected | No |

Expand Down