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

Toolbars: Add dynamicTitle option #17789

Merged
merged 3 commits into from Apr 28, 2022

Conversation

cocco3
Copy link
Contributor

@cocco3 cocco3 commented Mar 24, 2022

Issue: #17790

What I did

  • Add a dynamicTitle option to display the title of the selected item in the Toolbar.
  • This feature is opt in so it does not disrupt anyone's existing UI

toolbar-dynamic-title

How to test

  1. Add dynamicTitle: true to any global type
  2. Change the value in the toolbar
  3. The Toolbar should display the title of the selected item

Example with a theme globalType

export const globalTypes = {
  theme: {
    name: 'Theme',
    description: 'Global theme for components',
    toolbar: {
      dynamicTitle: true,
      icon: 'circlehollow',
      title: 'Theme',
      items: [
        { value: 'light', icon: 'circlehollow', title: 'Light' },
        { value: 'dark', icon: 'circle', title: 'Dark' },
      ],
    },
  },
};

@nx-cloud
Copy link

nx-cloud bot commented Mar 24, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit b1e9448. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@cocco3
Copy link
Contributor Author

cocco3 commented Mar 24, 2022

Hello! This is my first contribution - if there is anything additional y'all need I'm happy to provide it!

@shilman shilman changed the title Toolbar - add dynamicTitle config Toolbars: Add dynamicTitle config Mar 28, 2022
@shilman shilman self-assigned this Mar 28, 2022
@shilman shilman changed the title Toolbars: Add dynamicTitle config Toolbars: Add dynamicTitle option Mar 28, 2022
@MichaelArestad
Copy link
Contributor

Howdy @cocco3! This is great! Once the code is reviewed, I think this will be ready to merge.

@yannbf
Copy link
Member

yannbf commented Apr 12, 2022

@cocco3 that's super awesome!! Thanks for this contribution.
We should add some documentation for that as well cc @jonniebigodes

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 💯

@shilman shilman merged commit 1a6ea86 into storybookjs:next Apr 28, 2022
@cocco3 cocco3 deleted the toolbar-dynamic-title branch April 28, 2022 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants