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

Get some features from ClojureScript devcards #19

Closed
arunoda opened this issue Apr 2, 2016 · 17 comments
Closed

Get some features from ClojureScript devcards #19

arunoda opened this issue Apr 2, 2016 · 17 comments

Comments

@arunoda
Copy link
Member

arunoda commented Apr 2, 2016

See: https://github.com/bhauman/devcards

Clojurescript devcards is a very similar project but they have implemented some cool features which reminds me iPython notebooks.

It has a concept of card (which is similar to story in our case). Unlike in our case, we can render not only React elements, but markdown and tests as cards.
See: https://vimeo.com/97078905

Which is very useful for creating self describing documentations.

What we can get from Devcards

It's unwise if we just clone all the features of devcards. But we can inspire from it. Here are some of the things we can do.

  • Allow to add a markdown description for each story. (Technically, there can be stories with just the markdown)
  • We can also show proptypes and what are they for a given React component. It's nice, if we can show them with a story.
  • We shouldn't write test cases inside stories, but we should run tests and watch them. If any of the test failed, we can report it inside the storybook. (May be a red alert and show logs)
@kokjinsam
Copy link

One of other things that I'm working on to add for my team is markdown description. Perhaps I can send another PR on that?

I don't quite understand point 2. Mind to elaborate more?

@glenjamin
Copy link
Contributor

We can also show proptypes and what are they for a given React component. It's nice, if we can show them with a story.

That's a great idea!

@arunoda
Copy link
Member Author

arunoda commented Apr 2, 2016

@sammkj yes please 👍

We can also show proptypes and what are they for a given React component. It's nice, if we can show them with a story.

Basically, with this we are just reading propTypes for a given component class and just list them. It's kind of a documentation for a component.

@glenjamin Thanks.

@chrislloyd
Copy link

We can also show proptypes and what are they for a given React component. It's nice, if we can show them with a story.

Other than a property name, there's not enough reflective data in Reacts PropTypes to extract that information. Facebook uses (and recommends) static analysis to access that data: facebook/react#4794

@chrislloyd
Copy link

Also, why do you not recommend writing tests inside of stories?

@nicksp
Copy link
Contributor

nicksp commented Apr 5, 2016

@arunoda Hi there,

Have some local groundwork for exactly these two features that I'd like to integrate in your tool :)

  1. Allow to add a markdown description for each story. (Technically, there can be stories with just the markdown)
  2. We can also show proptypes and what are they for a given React component. It's nice, if we can show them with a story.

How shall i put a note that i started to work on it? And what do you think if i'll develop it?

@arunoda
Copy link
Member Author

arunoda commented Apr 5, 2016

@nicksp awesome.

Technically, there can be stories with just the markdown.
Yes. That's what we can start with. Something like this.

import { storiesOf, markdown } from '@kadira/storybook';

storiesOf('Something')
   .add('description', markdown(`
      ## This is the a great component.
      ...
   `));

This markdown will return a React element. So, it will work without any additional setup.

We can also show proptypes and what are they for a given React component. It's nice, if we can show them with a story.

Yes. It's nice to show this with the user's component. This is also same for the markdown description as well. I think it's great if we can create a new panel just below the iframe which shows these information if it contains within a story.

@nicksp
Copy link
Contributor

nicksp commented Apr 5, 2016

@arunoda How shall i start? I mean do i need to create and issues and mark that i'm working on it or what?

So, since this is a relatively complex task, i cat start with little things first and go further step by step. And in the meantime we can discuss the implemented stuff and alter it if needed.

@arunoda
Copy link
Member Author

arunoda commented Apr 5, 2016

@nicksp just add a note and start working on it. May be just work on a simple task.
Once you done something, just create a PR and link to this issue.
(PR doesn't need to be complete)

@nicksp
Copy link
Contributor

nicksp commented Apr 5, 2016

@arunoda Sounds good. Will ad a note right here then, in that specific issue. But since i don't have that much free time unfortunately, it won't be fast development process... just so you know. But i'll do my best. Would really love to pimp that project.

@arunoda
Copy link
Member Author

arunoda commented Apr 5, 2016

@nicksp No problem. Take your time. If we are working on that, I will let you know.

@nicksp
Copy link
Contributor

nicksp commented Apr 6, 2016

Started implementation of the following tasks:

  • Allow to add a markdown description for each story. (Technically, there can be stories with just the markdown)
  • We can also show proptypes and what are they for a given React component. It's nice, if we can show them with a story.

@arunoda
Copy link
Member Author

arunoda commented Apr 11, 2016

@nicksp We discuss a bit about this in our office. So, we thought rather than doing any changes to Storybook core, may be we can use some helper components to achieve these. See some sample code:

import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import { Button } from '../button';
import { Container, Markdown, PropTable } from '@you/storybook-helpers';

storiesOf('Button', module)
  .add('with a text', () => (
    <Container>
      <Markdown>
        ## Rendering a button

        This is how you can render a button.
      </Markdown>
      <Button>Button Name</Button>
      <PropTable component={Button} />
    </Container>
  ));

@jeef3
Copy link
Contributor

jeef3 commented Apr 11, 2016

The only catch with something like that, would be if you're still wanting that component resizer (#17) . That resizes the whole iframe I think currently?

So you would end up possibly needing another helper to wrap the component (and then only resize that?).

<Container>
  <Markdown>
    ## Rendering a button
    This is how you can render a button.
  </Markdown>
  <Component>
    <Button>Text name</Button>
  </Component>
  <PropTable component={Button} />
</Container>

@arunoda
Copy link
Member Author

arunoda commented Apr 11, 2016

@jeef3 That's a good point.

@nicksp
Copy link
Contributor

nicksp commented Apr 12, 2016

@arunoda Yep, sounds like a good solution. I like idea of separate components doing its stuff only. So, will implement on my account then, as a separate component which you can you later.

@bronson bronson mentioned this issue Jun 19, 2016
@arunoda
Copy link
Member Author

arunoda commented Jun 20, 2016

I'm going to close this since we'll be working on some of these features as extensions to react storybook.
See: https://github.com/kadirahq/react-storybook-story for an example.

We'll be launching an addon API soon.

@arunoda arunoda closed this as completed Jun 20, 2016
ndelangen pushed a commit that referenced this issue Apr 5, 2017
Add Circle-Ci build status image to the readme
ndelangen pushed a commit that referenced this issue Apr 5, 2017
fixes #18 : create react app public directory
ndelangen pushed a commit that referenced this issue Apr 11, 2017
ndelangen pushed a commit that referenced this issue Apr 15, 2017
Update eslint to version 3.6.1 🚀
JReinhold added a commit that referenced this issue May 31, 2023
Write Changelog: support --patches-only option
ndelangen pushed a commit that referenced this issue Feb 23, 2024
Implemented bare minimum list component
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

6 participants