-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
♻️Migrate Stories 62..65 to args
#37730
Changes from 4 commits
cf79d74
34ed769
c372738
1149b57
647d267
e16cbad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,75 @@ | ||
// @ts-ignore | ||
import {boolean, object, text, withKnobs} from '@storybook/addon-knobs'; | ||
|
||
// @ts-nocheck | ||
import * as Preact from '#preact'; | ||
import {ContainWrapper, Wrapper} from '#preact/component'; | ||
|
||
export default { | ||
title: '0/Wrappers', | ||
decorators: [withKnobs], | ||
}; | ||
|
||
export const wrapper = () => { | ||
const asProp = text('As', 'span'); | ||
const className = text('className', ''); | ||
const style = object('style', {border: '1px solid'}); | ||
const wrapperClassName = text('wrapperClassName', ''); | ||
const wrapperStyle = object('wrapperStyle', {}); | ||
const ariaLabel = text('ariaLabel', 'aria label'); | ||
export const wrapper = ({ariaLabel, asProp, className, ...args}) => { | ||
return ( | ||
<Wrapper | ||
as={asProp} | ||
class={className} | ||
style={style} | ||
wrapperClassName={wrapperClassName} | ||
wrapperStyle={wrapperStyle} | ||
aria-label={ariaLabel} | ||
> | ||
<Wrapper as={asProp} class={className} aria-label={ariaLabel} {...args}> | ||
content | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
export const containWrapper = () => { | ||
const asProp = text('As', 'div'); | ||
const className = text('className', ''); | ||
const style = object('style', {border: '1px solid', width: 200, height: 50}); | ||
const wrapperClassName = text('wrapperClassName', ''); | ||
const wrapperStyle = object('wrapperStyle', {padding: 4}); | ||
const contentClassName = text('contentClassName', 'content'); | ||
const contentStyle = object('contentStyle', {border: '1px dotted'}); | ||
const size = boolean('size', true); | ||
const layout = boolean('layout', true); | ||
const paint = boolean('paint', true); | ||
const ariaLabel = text('ariaLabel', 'aria label'); | ||
wrapper.args = { | ||
asProp: 'span', | ||
ariaLabel: 'aria Label', | ||
className: '', | ||
wrapperClassName: '', | ||
}; | ||
|
||
wrapper.argTypes = { | ||
style: { | ||
name: 'style', | ||
defaultValue: {border: '1px solid'}, | ||
control: {type: 'object'}, | ||
}, | ||
wrapperStyle: { | ||
name: 'wrapperStyle', | ||
control: {type: 'object'}, | ||
}, | ||
}; | ||
|
||
export const containWrapper = ({ariaLabel, asProp, className, ...args}) => { | ||
return ( | ||
<ContainWrapper | ||
as={asProp} | ||
class={className} | ||
style={style} | ||
wrapperClassName={wrapperClassName} | ||
wrapperStyle={wrapperStyle} | ||
contentClassName={contentClassName} | ||
contentStyle={contentStyle} | ||
size={size} | ||
layout={layout} | ||
paint={paint} | ||
aria-label={ariaLabel} | ||
{...args} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
> | ||
content | ||
</ContainWrapper> | ||
); | ||
}; | ||
|
||
containWrapper.args = { | ||
asProp: 'div', | ||
ariaLabel: 'aria Label', | ||
className: '', | ||
contentClassName: 'content', | ||
wrapperClassName: '', | ||
size: true, | ||
layout: true, | ||
paint: true, | ||
}; | ||
|
||
containWrapper.argTypes = { | ||
style: { | ||
name: 'style', | ||
defaultValue: {border: '1px solid', width: 200, height: 50}, | ||
control: {type: 'object'}, | ||
}, | ||
wrapperStyle: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this need the default value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah yes! thank you :) |
||
name: 'wrapperStyle', | ||
control: {type: 'object'}, | ||
}, | ||
contentStyle: { | ||
name: 'contentStyle', | ||
defaultValue: {border: '1px dotted'}, | ||
control: {type: 'object'}, | ||
}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FMI: why is this named _default? Does that do something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a convention we name the first story
_default
to make it clear its one that gets default selected when you navigate to the story. It doesnt do anything special in the storybook its more just for usthe
default
on line 9/6 That one does some storybook internal magic and is important to be named that way