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

refactor(storybook): migrate to v7 - part 2 #2691

Open
wants to merge 12 commits into
base: cm-update-storybook
Choose a base branch
from

Conversation

kark
Copy link
Contributor

@kark kark commented Jan 17, 2024

Summary

Description

Copy link

changeset-bot bot commented Jan 17, 2024

⚠️ No Changeset found

Latest commit: 944daa1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ui-kit ❌ Failed (Inspect) Mar 14, 2024 1:05pm

@kark kark changed the title refactor: migrate pagination, link-button, link, primary-action-dropd… refactor(storybook): migrate to v7 - part 2 Jan 17, 2024
@kark kark marked this pull request as ready for review January 18, 2024 10:02
}
};

const meta = {
Copy link
Contributor

Choose a reason for hiding this comment

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

This story is not working correctly locally for me.
I'd like to have a sync about it. 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, thank you, I'll schedule a meeting. I just wonder, it any different from https://uikit.commercetools.com/?path=/story/components-pagination--pagesizeselector?

Copy link
Contributor

Choose a reason for hiding this comment

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

Something I found out is that using inline: false will make the controls to not work.
Perhaps we can wrap the story in a component which applies that height.

image

Copy link
Contributor

Choose a reason for hiding this comment

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

I found out that maybe using the height property can work:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I updated the story to use this parameter. However, I noticed a down side of using it. It works well in the Docs page and the story page, but it doesn't work in the "README" page. That is why I removed the <Canvas of={PaginationStories.Default} /> from the pagination's readme.mdx.

Copy link
Contributor

Choose a reason for hiding this comment

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

According to the docs, it seems we can adjust the height of the story the Canvas component renders.

Testing it locally, this example seems to work:

<Canvas of={PaginationStories.Default} story={{ height: '560px' }}/>

image

The downside is that I had to use a high value for the height, but I think it's a fair compromise right now and maybe can take a deeper look in the future.

Copy link
Contributor Author

@kark kark Jan 24, 2024

Choose a reason for hiding this comment

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

Thanks.
I'm encountering issues regardless of the set height. There are ongoing discussions in the Storybook repo related to the challenges with fixed positioning.
storybookjs/storybook#23586
storybookjs/storybook#23699

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe then we can just add a wrapper for the component in the story?

packages/components/stamp/src/stamp.stories.tsx Outdated Show resolved Hide resolved
Comment on lines +53 to +55
<Canvas>
<Story of={PaginationStories.Default} height="100vh" />
</Canvas>
Copy link
Contributor Author

@kark kark Feb 12, 2024

Choose a reason for hiding this comment

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

This was the only way I figured out to make this story work on the docs page.

type Story = StoryObj<typeof meta>;

export const Default: Story = {
// @ts-ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering why do we need this ignore directive.

I know this is a deprecated component, but since we want to keep the story, maybe we can just add its two required props.

Comment on lines 19 to 24
argTypes: {
tone: {
control: 'select',
options: ['primary', 'inverted', 'secondary'],
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we agree on having the args type definitions at the meta level?

Comment on lines 25 to 27
argTypes: {
...hideControls(['tone', 'children', 'icon', 'label']),
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we agree on having the args type definitions at the meta level?

@kark
Copy link
Contributor Author

kark commented Mar 14, 2024

@CarlosCortizasCT argTypes at the meta level and link button story updated in 944daa1

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.

None yet

2 participants