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

feat: update globals with selected theme - react #63

Closed
wants to merge 1 commit into from

Conversation

nickofthyme
Copy link

@nickofthyme nickofthyme commented Jul 12, 2021

closes #62

Sync selected theme name with globals context. This allows for consuming the selected theme within a top-level decorator as is done in @storybook/addon-backgrounds.

An example usage of this would be...

// .storybook/preview.js

import React from 'react';

export const decorators = [
  (Story, context) => (
    <div style={{ margin: '3em' }}>
      <h1>Theme: {context.globals.themes.value}</h1>
      <Story />
    </div>
  ),
];

@nickofthyme nickofthyme deleted the feat/globals-react branch July 19, 2021 16:05
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.

Add selected theme to globals
1 participant