Skip to content

Commit

Permalink
docs: update docs for newprops usage
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed May 5, 2020
1 parent 62366e4 commit 4c1eceb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
31 changes: 16 additions & 15 deletions core/specification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ _defined in [@component-controls/specification/src/stories.ts](https://github.co

### properties

| Name | Type | Description |
| ------ | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `loc*` | [CodeLocation](#codelocation) | where in the story source code is the argument used code location is relative to the start of the story |
| `name` | [SourceIdentifier](#sourceidentifier) | optional name for the usage of the argument example: export const story = ({ value }) => <Story value={{ age: value }} />; in this example the name will be 'age' |
| Name | Type | Description |
| ----------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `loc*` | [CodeLocation](#codelocation) | where in the story source code is the argument used code location is relative to the start of the story |
| `name` | [SourceIdentifier](#sourceidentifier) | optional name for the usage of the argument example: export const story = ({ value }) => <Story value={{ age: value }} />; in this example the name will be 'age' |
| `shorthand` | boolean | true if the property is a 'shorthand'. { prop: value } - not a shorthand. { prop } - a shorthand. |

## SourceIdentifier

Expand All @@ -108,7 +109,7 @@ _defined in [@component-controls/specification/src/stories.ts](https://github.co

map of stories. The id is compatible with CSF story ids

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L142)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L148)_

`id`\*: string: [Story](#story)

Expand All @@ -118,7 +119,7 @@ a group of stories. Usually multiple stories are in one csf file
and the 'group' is the default export
in the case of MDX stories, the kind is crated using a <Meta /> tag

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L151)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L157)_

`name`\*: string: any

Expand All @@ -145,7 +146,7 @@ _defined in [@component-controls/specification/src/stories.ts](https://github.co

store of stories information in memory after the loader is applied

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L260)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L266)_



Expand All @@ -161,7 +162,7 @@ _defined in [@component-controls/specification/src/stories.ts](https://github.co

Story interface - usually extracted by the AST instrumenting loader

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L67)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L73)_



Expand All @@ -188,7 +189,7 @@ _defined in [@component-controls/specification/src/stories.ts](https://github.co

arguments passed to the 'story' function, extracted by an AST loader

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L30)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L36)_



Expand All @@ -205,15 +206,15 @@ _defined in [@component-controls/specification/src/stories.ts](https://github.co

list of components used in stories

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L239)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L245)_

`fileName`\*: string: [StoryComponent](#storycomponent)

## StoryKinds

list of story files, or groups

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L246)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L252)_

`title`\*: string: [StoriesKind](#storieskind)

Expand All @@ -222,15 +223,15 @@ _defined in [@component-controls/specification/src/stories.ts](https://github.co
list of configuration parameters for stories and 'kinds'
can be specified either through CSF or MDX tags

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L60)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L66)_

`name`\*: string: any

## StoryStories

list of stories

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L253)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L259)_

`id`\*: string: [Story](#story)

Expand All @@ -239,7 +240,7 @@ _defined in [@component-controls/specification/src/stories.ts](https://github.co
list of story arguments. Each argument can be a deconstructed argument of itself
the first argument are the control 'values'

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L54)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L60)_

[StoryArgument](#storyargument)\[]

Expand Down Expand Up @@ -801,7 +802,7 @@ _defined in [@component-controls/specification/src/utility.ts](https://github.co
list of story arguments. Each argument can be a deconstructed argument of itself
the first argument are the control 'values'

_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L54)_
_defined in [@component-controls/specification/src/stories.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/stories.ts#L60)_

[StoryArgument](#storyargument)\[]

Expand Down
6 changes: 3 additions & 3 deletions core/specification/src/stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export interface ArgUsageLocation {
*/
name?: SourceIdentifier;

/** true ,f the property is a 'shorthand' value and name the same
* example { prop: value } - not a shorthand
* example { prop } - is a shorthand
/** true if the property is a 'shorthand'.
* { prop: value } - not a shorthand.
* { prop } - a shorthand.
*/
shorthand?: boolean;
}
Expand Down
6 changes: 4 additions & 2 deletions integrations/storybook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ The list of available controls and their documented properties is available [her
Smart Controls use a story component's properties table type information to generate automatically controls for the story.

There are 2 requirements for a story to use smart controls:
1. The story needs to have a component assigned, and this component needs to have a valid properties table (it can be typescript, or prop-types or any other format supported by component-controls props-info extensions).
2. The story needs to accept "some" parameters / internally detected within the source loaders / enabling the story to use the passed control values.

1. The story needs to have a component assigned, and this component needs to have a valid properties table (it can be typescript, or prop-types or any other format supported by component-controls props-info extensions).

2. The story needs to accept "some" parameters / internally detected within the source loaders / enabling the story to use the passed control values.

A screenshot of smart controls in action.

Expand Down
7 changes: 1 addition & 6 deletions ui/blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
- [<ins>Stories</ins>](#insstoriesins)
- [<ins>Story</ins>](#insstoryins)
- [<ins>StorySource</ins>](#insstorysourceins)
- [<ins>getArgumentsLocations</ins>](#insgetargumentslocationsins)
- [<ins>Subtitle</ins>](#inssubtitleins)
- [<ins>Title</ins>](#institleins)
- [<ins>InvalidType</ins>](#insinvalidtypeins)
Expand All @@ -36,7 +35,7 @@ Some of the guiding design goals for this library:

# List of components

<react-docgen-typescript path="./src" exclude="index.ts,repositoryActions.tsx,StoryContext.tsx,utils.ts,ComponentsContext.tsx,context.tsx,argument-utils.ts,channel.ts" />
<react-docgen-typescript path="./src" exclude="index.ts,repositoryActions.tsx,StoryContext.tsx,utils.ts,ComponentsContext.tsx,context.tsx,argument-utils.ts,channel.ts,SinglePropsTable.tsx" />

<!-- START-REACT-DOCGEN-TYPESCRIPT -->

Expand Down Expand Up @@ -296,10 +295,6 @@ _StorySource [source code](https:/github.com/ccontrols/component-controls/tree/m
| `style` | _any_ | css styles for the container. |
| `as` | _any_ | syntax container as element. Can be used as \`div\` or \`span\`. |

## <ins>getArgumentsLocations</ins>

_getArgumentsLocations [source code](https:/github.com/ccontrols/component-controls/tree/master/ui/blocks/src/StorySource/arg-values.ts)_

## <ins>Subtitle</ins>

displays a subtitle as assigned to the story parameters:
Expand Down

0 comments on commit 4c1eceb

Please sign in to comment.