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

Merge pull request #9229 from storybookjs/core/preview-layouts #9229

Merged
merged 14 commits into from
Jan 20, 2020

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Dec 23, 2019

This adds support for a layout parameter: #8358 (comment)

The parameter has 3 possible values: 'padded' (default), 'fullscreen' & 'center'

Here's how you use it:

export default {
	title: 'my Component',
	parameters: {
		layout: 'fullscreen'
	}
}

This allows users to specify whether they want padding or now, and also deprecates addon-centered, making it a core-feature

@vercel
Copy link

vercel bot commented Dec 23, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/e0wwmy3hp
✅ Preview: https://monorepo-git-core-preview-layouts.storybook.now.sh

@ndelangen ndelangen changed the base branch from next to next-6.0.0 December 23, 2019 17:42
Copy link
Member

@ghengeveld ghengeveld left a comment

Choose a reason for hiding this comment

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

I like the idea of a layout option, but I'm not so keen on this implementation. I don't think we need memoization and I would really like to have the possibility to provide a callback instead of a value so we can determine the value based on the story context.

I would really like to champion this change as soon as I'm back at work.

@ghengeveld
Copy link
Member

I updated the branch, refactored some logic to avoid introducing a dependency and added support for layout based on story context.

@vercel vercel bot temporarily deployed to Preview January 8, 2020 15:53 Inactive
@ndelangen ndelangen changed the base branch from next-6.0.0 to next January 20, 2020 20:53
@ndelangen ndelangen changed the title Core/preview layouts Merge pull request #9229 from storybookjs/core/preview-layouts Jan 20, 2020
@ndelangen ndelangen merged commit 3eeed60 into next Jan 20, 2020
@ndelangen ndelangen deleted the core/preview-layouts branch January 20, 2020 21:00
@ghengeveld
Copy link
Member

🎉

@shilman
Copy link
Member

shilman commented Jan 21, 2020

🎉🎉🎉

@ndelangen @ghengeveld is there a corresponding documentation and/or MIGRATION update that's missing? 🙏

@ndelangen
Copy link
Member Author

@shilman YES, I think we should add some proper documentation for this.

@frebro
Copy link

frebro commented Feb 24, 2020

Trying to get this working on MDX with Vue. Is it supposed to look like this?

<Preview layout="fullscreen">
  <Story name="MyStory">
    {{
      components: { MyComponent },
      template: '<MyComponent />'
    }}
  </Story>
</Preview>

I'm using "next" (currently 6.0.0-alpha.18) for all Storybook packages.

@ndelangen
Copy link
Member Author

I'll investigate this @frebro

@frebro
Copy link

frebro commented Feb 24, 2020

Tried with your example in the PR above @ndelangen, and it works fine. Hartelijk bedankt!

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.

4 participants