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

Addon-docs: Add Controls ("knobs") support to Props #6639

Closed
3 tasks
shilman opened this issue Apr 26, 2019 · 20 comments
Closed
3 tasks

Addon-docs: Add Controls ("knobs") support to Props #6639

shilman opened this issue Apr 26, 2019 · 20 comments

Comments

@shilman
Copy link
Member

shilman commented Apr 26, 2019

  • Refactor to use Args
  • Add controls to PropTable
  • Update tests & documentation

More generally: #6700

@stale stale bot added the inactive label May 17, 2019
@shilman shilman removed the inactive label May 17, 2019
@shilman shilman assigned shilman and JeroenReumkens and unassigned shilman May 21, 2019
@stale stale bot added the inactive label Jun 11, 2019
@shilman shilman removed the inactive label Jun 11, 2019
@stale stale bot added the inactive label Jul 2, 2019
@storybookjs storybookjs deleted a comment from stale bot Jul 2, 2019
@stale stale bot removed the inactive label Jul 2, 2019
@storybookjs storybookjs deleted a comment from stale bot Jul 2, 2019
@storybookjs storybookjs deleted a comment from stale bot Jul 2, 2019
@stale stale bot added the inactive label Jul 23, 2019
@storybookjs storybookjs deleted a comment from stale bot Jul 24, 2019
@stale stale bot removed the inactive label Jul 24, 2019
@shilman shilman added the todo label Jul 24, 2019
@Portals
Copy link

Portals commented Aug 27, 2019

Will this be released in 5.2.0?

@shilman shilman added this to the 5.3.0 milestone Aug 27, 2019
@shilman
Copy link
Member Author

shilman commented Aug 27, 2019

@Portals hopefully 5.3. 5.2 is almost ready to ship, so really just bugfixes and minor tweaks at this point!

@atanasster
Copy link
Member

Anyone working on this, can i give it a try if you have some design mockups

@shilman
Copy link
Member Author

shilman commented Sep 2, 2019

@atanasster @JeroenReumkens has built an amazing prototype. I don't know the current status: JeroenReumkens@2a9267e

@YuunYang
Copy link

YuunYang commented Apr 15, 2020

I upgrade to prerelease version, but seems we still cant use knobs in docs?

the errors I got:
image
but work fine on version 5.3.18

@shilman
Copy link
Member Author

shilman commented Apr 15, 2020

@YuunYang all @storybook/* should be on the same version. so if you upgrade @storybook/addon-docs to 6.0 but don't upgrade @storybook/react you shouldn't expect it to work.

Also the controls PR hasn't been merged yet.

@shilman
Copy link
Member Author

shilman commented Apr 15, 2020

Jeepers creepers!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.34 containing PR #10354 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman
Copy link
Member Author

shilman commented Apr 15, 2020

Huzzah!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.35 containing PR #10432 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman
Copy link
Member Author

shilman commented Apr 16, 2020

Yee-haw!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.37 containing PR #10451 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

@shilman
Copy link
Member Author

shilman commented Apr 17, 2020

I've written a Storybook Args w/ CRA & TypeScript Walkthrough for anybody who wants to try it:

args-controls

@lpoulter
Copy link

@shilman This write up is great thanks. Do you need typescript to get the full benefits of args?

@YuunYang
Copy link

Awesome !!!

@shilman
Copy link
Member Author

shilman commented Apr 17, 2020

@lpoulter No, it works in React/JS with PropTypes ... and should work with Vue, Angular, Ember, Web components--though I haven't tested that yet (and I wouldn't be surprised if there are tweaks needed to get it working. And if you don't have any of those, you can declare your own ArgTypes to make it work in ANY setup (more documentation forthcoming on that, but you can probably reverse engineer it from the existing docs).

@YuunYang
Copy link

YuunYang commented Apr 17, 2020

image

seems got an error, if I want reset the filed to initial value, it can't trigger

even I change another field, It still not changed, and by the way, maybe we need a throttle function.
@shilman

@shilman
Copy link
Member Author

shilman commented Apr 17, 2020

@YuunYang do you have a repro i can look at?

@YuunYang
Copy link

@shilman I'm sorry I cant, because it is a private repo, and our company forbid us to share the code. my English is not very good, maybe I didn't describe this question detailedly, I will give you a live pic next week when I back to work.

@YuunYang
Copy link

YuunYang commented Apr 20, 2020

Apr-20-2020 10-18-27

The HD GIF https://drive.google.com/file/d/1jONAgoxzJTj59S2r-MqAMoW8N6xxNKpJ/view?usp=sharing

Looks at this example, the default value is right, when I change the value It changed in the meantime, but when I try to change it to it default value "right", it seems not changed.

this is my code

import React from 'react';
import Xtable from '../Basic';
import getConfig from '../utils/getConfig';
import { IXtableCoreConfig } from '../../src/Xtable/type';

export const Basic = ({ ...config }: IXtableCoreConfig ) => {
  console.log(config)
  return <Xtable {...config} />
}

const config = {
  // scroll: { x: 2000 },
  headerWidgetsAlign: 'right',
  showEditBtn: false,
  showResetBtn: false,
  showSearchBtn: false,
  showDeleteBtn: false,
  searchTrigger: 'onChange',
  ...
}

Basic.story = {
  args: {
    ...config
  }
}

export default {
  title: 'xtable',
  parameters: {
    component: Basic,
    componentSubtitle: '',
  },
};

@shilman

Edit:
I just tried using it in mdx, it works, but in tsx, it failed

@shilman
Copy link
Member Author

shilman commented Apr 20, 2020

w00t!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.40 containing PR #10473 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants