Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Created September 9, 2020 08:41
Show Gist options
  • Save PaulieScanlon/14d66604fa2abf8424d866485b97dbb5 to your computer and use it in GitHub Desktop.
Save PaulieScanlon/14d66604fa2abf8424d866485b97dbb5 to your computer and use it in GitHub Desktop.
import React from 'react'
// import { YourComponent } from 'your-directory'
export default {
title: 'components/Hackerman-3',
parameters: {
// component: YourComponent,
componentSubtitle: '...',
},
}
export const Usage = () => <button>click me</button>
export const SomeButton = (args) => (
<button onClick={(event) => args.handleClick(event)} value="Boogy Time">
click me
</button>
)
SomeButton.parameters = {
docs: {
description: {
story:
"`args` are an absolute faff but basically you pass in whatever arguments you want, in this case it's the `handleClick` and is avaiable to the Story at `ags.handleClick`",
},
},
}
SomeButton.args = {
handleClick: (event) => alert(event.currentTarget.value),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment