-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove storybook-addon-styled-component-theme (#10574)
- Loading branch information
Showing
5 changed files
with
30 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import { addDecorator } from "@storybook/react"; | ||
import { withThemesProvider } from "storybook-addon-styled-component-theme"; | ||
|
||
import WithProviders from "./withProvider"; | ||
import { theme } from "../src/theme"; | ||
import { withProviders } from "./withProvider"; | ||
|
||
addDecorator(withThemesProvider([theme], WithProviders)); | ||
addDecorator(withProviders); | ||
|
||
export const parameters = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,32 @@ | ||
import { MemoryRouter } from "react-router-dom"; | ||
import * as React from "react"; | ||
import { IntlProvider } from "react-intl"; | ||
// import { createMemoryHistory } from "history"; | ||
import { ThemeProvider } from "styled-components"; | ||
|
||
// TODO: theme was not working correctly so imported directly | ||
import { theme, Theme } from "../src/theme"; | ||
import { theme } from "../src/theme"; | ||
import GlobalStyle from "../src/global-styles"; | ||
import messages from "../src/locales/en.json"; | ||
import { FeatureService } from "../src/hooks/services/Feature"; | ||
import { ConfigServiceProvider, defaultConfig } from "../src/config"; | ||
import { ServicesProvider } from "../src/core/servicesProvider"; | ||
|
||
interface Props { | ||
theme?: Theme; | ||
} | ||
|
||
interface Props { | ||
children?: React.ReactNode; | ||
theme?: Theme; | ||
} | ||
|
||
class WithProviders extends React.Component<Props> { | ||
render() { | ||
const { children } = this.props; | ||
|
||
return ( | ||
<ServicesProvider> | ||
<MemoryRouter> | ||
<IntlProvider messages={messages} locale={"en"}> | ||
<ThemeProvider theme={theme}> | ||
<ConfigServiceProvider | ||
defaultConfig={defaultConfig} | ||
providers={[]} | ||
> | ||
<FeatureService> | ||
<GlobalStyle /> | ||
{children} | ||
</FeatureService> | ||
</ConfigServiceProvider> | ||
</ThemeProvider> | ||
</IntlProvider> | ||
</MemoryRouter> | ||
</ServicesProvider> | ||
); | ||
} | ||
} | ||
|
||
export default WithProviders; | ||
export const withProviders = (getStory) => ( | ||
<ServicesProvider> | ||
<MemoryRouter> | ||
<IntlProvider messages={messages} locale={"en"}> | ||
<ThemeProvider theme={theme}> | ||
<ConfigServiceProvider | ||
defaultConfig={defaultConfig} | ||
providers={[]} | ||
> | ||
<FeatureService> | ||
<GlobalStyle /> | ||
{getStory()} | ||
</FeatureService> | ||
</ConfigServiceProvider> | ||
</ThemeProvider> | ||
</IntlProvider> | ||
</MemoryRouter> | ||
</ServicesProvider> | ||
); |
Oops, something went wrong.