I'm using Storybook together with Material-UI components. When importing and implementing them there and I look into the produced code snippets in the 'show code' tab I get weird withStyles(forwardRef(COMPONENT)) outputs.
This is my code:
import React from 'react'
import { Story, Meta } from '@storybook/react/types-6-0'
import { MenuItem, Select } from '@material-ui/core'
import {
ArgsTable,
Description,
Primary,
PRIMARY_STORY,
Stories,
Subtitle,
Title,
} from '@storybook/addon-docs/blocks'
export default {
title: 'Reusable/Themed Components/SelectComponent',
component: Select,
argTypes: {
variant: {
control: {
type: 'select',
options: ['filled', 'outlined', 'standard'],
defaultValue: ['standard'],
},
},
},
parameters: {
docs: {
page: () => (
<>
<Title>Select</Title>
<Subtitle>
This is the docs for the generic Select component.
</Subtitle>
<Description>Lirum Larum Description.</Description>
<Primary />
<ArgsTable story={PRIMARY_STORY} />
<Stories includePrimary />
</>
),
},
},
} as Meta
const Template: Story = ({ ...args }) => (
<Select variant={args.variant} style={{ width: '120px' }}>
<MenuItem value="german" selected>
Deutsch
</MenuItem>
<MenuItem value="english">Englisch</MenuItem>
<MenuItem value="arabic">Arabisch</MenuItem>
</Select>
)
export const SelectComponentStory = Template.bind({})
SelectComponentStory.storyName = 'SelectComponent'
Output from the 'show code' tab in the Storybook 'playground':
<WithStyles(ForwardRef(Select))
style={{
width: '120px'
}}
>
<WithStyles(ForwardRef(MenuItem))
selected
value="german"
>
Deutsch
</WithStyles(ForwardRef(MenuItem))>
<WithStyles(ForwardRef(MenuItem)) value="english">
Englisch
</WithStyles(ForwardRef(MenuItem))>
<WithStyles(ForwardRef(MenuItem)) value="arabic">
Arabisch
</WithStyles(ForwardRef(MenuItem))>
</WithStyles(ForwardRef(Select))>
Expected output that I'd like to see generated in the show code tab, so that developers and reuse it:
<Select variant='standard' style={{ width: '120px' }}>
<MenuItem value="german" selected>
Deutsch
</MenuItem>
<MenuItem value="english">Englisch</MenuItem>
<MenuItem value="arabic">Arabisch</MenuItem>
</Select>
Anyone know how to get there?
