Skip to content

Document how to customize the layout#69

Merged
arunoda merged 1 commit intostorybookjs:masterfrom
jide:custom-components-doc
Apr 7, 2016
Merged

Document how to customize the layout#69
arunoda merged 1 commit intostorybookjs:masterfrom
jide:custom-components-doc

Conversation

@jide
Copy link
Copy Markdown
Contributor

@jide jide commented Apr 7, 2016

No description provided.

Comment thread docs/api.md Outdated
}
```

This can also be used to customize the layout by duplicating the original [layout.js](https://raw.githubusercontent.com/kadirahq/react-storybook/master/src/client/ui/layout.js) file at `.storybook/layout.js` and setting webpack config like this :
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add a small title on top of this. Like: Customizing The UI.

@jide jide force-pushed the custom-components-doc branch from b8e4e13 to e425ee8 Compare April 7, 2016 10:13
@jide
Copy link
Copy Markdown
Contributor Author

jide commented Apr 7, 2016

I added a title and rephrased a bit.

@jide jide mentioned this pull request Apr 7, 2016
@arunoda
Copy link
Copy Markdown
Member

arunoda commented Apr 7, 2016

Awesome.

@arunoda arunoda merged commit ec78da8 into storybookjs:master Apr 7, 2016
@clauderic
Copy link
Copy Markdown

clauderic commented May 12, 2016

Can this be updated? The link to layout.js is broken

@jide
Copy link
Copy Markdown
Contributor Author

jide commented May 12, 2016

@clauderic
Copy link
Copy Markdown

Great! That still does not help though, the link is still broken over there 😿

@jide
Copy link
Copy Markdown
Contributor Author

jide commented May 12, 2016

Oh I see, yeah @arunda made significant changes recently. I guess it's the https://github.com/kadirahq/react-storybook/blob/master/src/client/manager/modules/ui/components/layout/index.js file now, but I did not dig more - you should be able to figure out the right configuration by changing the paths in the config and using this file instead.

@clauderic
Copy link
Copy Markdown

Hmmm okay. Doesn't seem to work anymore. It'd be great if the documentation on this was revised

@uipoet
Copy link
Copy Markdown

uipoet commented Jun 10, 2016

Attempted replacing a UI module following documentation and nothing happens, without errors.

@joaomilho
Copy link
Copy Markdown

+1

@csalvato
Copy link
Copy Markdown

Where's the documentation for this now? All links are dead. :)

ndelangen pushed a commit that referenced this pull request Apr 5, 2017
ndelangen pushed a commit that referenced this pull request Apr 5, 2017
ndelangen pushed a commit that referenced this pull request Apr 5, 2017
Provide storybook context to render
ndelangen pushed a commit that referenced this pull request Apr 5, 2017
…ils-15.3.1

react-addons-test-utils@15.3.1 untested ⚠️
@jeroenransijn
Copy link
Copy Markdown

I would like to know what the progress is on this?

@ndelangen
Copy link
Copy Markdown
Member

@jeroenransijn Could you open a new issue on this describing what's wrong? I'm not sure what to do with this now, and It's hard to keep track of a merged PR. Thanks!

@usulpro usulpro added the ui label Apr 22, 2017
@shilman shilman added the misc label May 27, 2017
@binomialstew
Copy link
Copy Markdown

I know the last question here is from over a year ago, but for anyone finding this issue that would like to use their own custom layout, you can use the webpack.NormalModuleReplacementPlugin to replace the import of layout.js via @storybook. For example, in your webpack config:

import { NormalModuleReplacementPlugin } from webpack
...
module.exports = (storybookBaseConfig, env) => {
  storybookBaseConfig.plugins = [
    // replace the import (in routes @storybook/ui/dist/modules/ui/routes.js) with your custom layout alias
    new NormalModuleReplacementPlugin(/^\.\/containers\/layout$/, 'custom-layout')
  ]
  ...
  storybookBaseConfig.resolve = {
    alias: {
      'custom-layout': path.resolve(project.basePath, '.storybook/layout.js')
    }
  }
}

@ndelangen
Copy link
Copy Markdown
Member

Working on refactoring and improving the UI right now,

Please share your ideas and customisations so I know what users want.

See:
#4086 (comment)

@binomialstew
Copy link
Copy Markdown

I would like the ability to disable the mobile layout set by isMobileDevice. I developed a custom mobile layout before it was available in storybook. The new release with the mobile layout overrides my addon-options config and breaks my layout.

@ndelangen
Copy link
Copy Markdown
Member

@binomialstew would the new mobile layout be what you want in the ui refactor or is the custom one you have something this new one doesn't?

Happy to look at your custom layout to take inspiration from.

Do you think it makes sense to keep your custom layout if there's a good mobile layout in storybook itself?

@binomialstew
Copy link
Copy Markdown

@ndelangen, the issue I have is more the implementation of the mobile layout rather than the UI itself. My main point of issue is it's triggered by user agent rather than css media queries. In my view, the default layout works well for iPad—the screen width is sufficient for the left sidebar, but still, the mobile layout is triggered and shown on iPads.

Another issue I had—the mobile layout seems to override any options that were set initially, like "showAddonPanel" or "goFullScreen". I had previously set up a button to toggle the addons panel, and this negates that.

I set up my storybook with media queries that hide the left sidebar and show a simplified header with a menu button where the stories are accessible—but only when the viewport is reduced to a specific width.

In general, I think that determining responsive layouts with CSS rather than user agent is a better approach because what's important is usually the screen size, more than anything else. For me, having an option to disable isMobileDevice would be sufficient, but if this were to be redone, I think the best approach would be to handle responsivity with media queries and also add an option to disable mobile layout.

@ndelangen
Copy link
Copy Markdown
Member

@binomialstew the media-query issue is addressed in my UI refactor.

the new mobile layout in this overhaul will show the component by default when loaded, regardless of settings, I might change that.

@ndelangen
Copy link
Copy Markdown
Member

#4086

ndelangen pushed a commit that referenced this pull request Feb 23, 2024
…-yarn-pnp-mode

Fix react joyride in yarn pnp mode
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 24, 2024

View your CI Pipeline Execution ↗ for commit e425ee8

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 1m 38s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-16 22:47:32 UTC

yannbf added a commit that referenced this pull request Apr 17, 2025
…sf-tool

no-redundant-story-name: use same naming algorithm as storybook
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.