Skip to content

Use storybook-react-intl addon#355

Merged
binh-dam-ibigroup merged 15 commits intoopentripplanner:masterfrom
ibi-group:use-storybook-react-intl-addon
Mar 14, 2022
Merged

Use storybook-react-intl addon#355
binh-dam-ibigroup merged 15 commits intoopentripplanner:masterfrom
ibi-group:use-storybook-react-intl-addon

Conversation

@binh-dam-ibigroup
Copy link
Copy Markdown
Collaborator

This PR will avoid the extra boiler plate code to load messages and provide an <IntlProvider> wrapper for each component.

As a result,

  • the locale selector is now on the Storybook toolbar.
  • some controls under the stories are moved or replaced.

@binh-dam-ibigroup
Copy link
Copy Markdown
Collaborator Author

This is ready for review now.

Copy link
Copy Markdown
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

Well done getting this added so seamlessly! Thanks also for cleaning up the snapshots now. Looks much better.

I have a few quick questions about some small details

Comment thread .storybook/preview.js
Comment thread .storybook/react-intl.js
Copy link
Copy Markdown
Contributor

@daniel-heppner-ibigroup daniel-heppner-ibigroup left a comment

Choose a reason for hiding this comment

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

Looks great! Feels very proper.

const intlDecorator = (Story: StoryType): ReactElement => (
<IntlProvider locale="en-US" messages={flatten(englishMessages)}>
const decorator = (Story: StoryType): ReactElement => (
<div>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is a surrounding div necessary? Would <> work?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That's possible indeed (see 2108869).

@daniel-heppner-ibigroup daniel-heppner-ibigroup removed their assignment Mar 11, 2022
@binh-dam-ibigroup binh-dam-ibigroup merged commit 033c80c into opentripplanner:master Mar 14, 2022
@binh-dam-ibigroup binh-dam-ibigroup deleted the use-storybook-react-intl-addon branch March 14, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants