-
Notifications
You must be signed in to change notification settings - Fork 9
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
Change Style guide to Storybook #39
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bc67247
Add configuration for storybook
JiwoonKim fc63480
Migrate styleguide examples to Storybook
JiwoonKim 5913d80
Replace deployment with Storybook gh-pages deployment
JiwoonKim b2b3469
Remove styleguidist from project
JiwoonKim 246eec3
Fix linting issues for storybook implementation
JiwoonKim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { configure } from '@storybook/react'; | ||
|
||
configure(require.context('../src', true, /\.stories\.js$/), module); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React, { Fragment } from 'react'; | ||
import SchemaTable from './index'; | ||
|
||
export default { | ||
title: 'Schema Table', | ||
component: SchemaTable, | ||
}; | ||
|
||
/** | ||
* Schema examples to use for displaying stories | ||
*/ | ||
const defaultSchemas = {}; | ||
|
||
defaultSchemas.boolean = require('../../../schemas/basicDataTypes/boolean/boolean.json'); | ||
defaultSchemas.null = require('../../../schemas/basicDataTypes/null/null.json'); | ||
defaultSchemas.integer = require('../../../schemas/basicDataTypes/numeric/integer.json'); | ||
defaultSchemas.numberMultiples = require('../../../schemas/basicDataTypes/numeric/numberMultiples.json'); | ||
defaultSchemas.numberRange = require('../../../schemas/basicDataTypes/numeric/numberRange.json'); | ||
defaultSchemas.stringPattern = require('../../../schemas/basicDataTypes/string/stringPattern.json'); | ||
defaultSchemas.stringFormat = require('../../../schemas/basicDataTypes/string/stringFormat.json'); | ||
|
||
const arraySchemas = {}; | ||
|
||
arraySchemas.emptyArray = require('../../../schemas/basicDataTypes/array/emptyArray.json'); | ||
arraySchemas.listValidation = require('../../../schemas/basicDataTypes/array/listValidation.json'); | ||
arraySchemas.tupleValidation = require('../../../schemas/basicDataTypes/array/tupleValidation.json'); | ||
arraySchemas.containsValidations = require('../../../schemas/basicDataTypes/array/containsValidation.json'); | ||
arraySchemas.additionalItems = require('../../../schemas/basicDataTypes/array/additionalItems.json'); | ||
|
||
const objectSchemas = {}; | ||
|
||
objectSchemas.emptyObject = require('../../../schemas/basicDataTypes/object/emptyObject.json'); | ||
objectSchemas.simpleObject = require('../../../schemas/basicDataTypes/object/simpleObject.json'); | ||
objectSchemas.propertySpecification = require('../../../schemas/basicDataTypes/object/propertySpecifications.json'); | ||
objectSchemas.propertyDependency = require('../../../schemas/basicDataTypes/object/propertyDependencies.json'); | ||
objectSchemas.requiredProperties = require('../../../schemas/basicDataTypes/object/requiredProperties.json'); | ||
|
||
export const defaultType = () => ( | ||
<Fragment> | ||
<h3>Boolean</h3> | ||
<SchemaTable schema={defaultSchemas.boolean} /> | ||
<h3>Null</h3> | ||
<SchemaTable schema={defaultSchemas.null} /> | ||
<h3>Integer</h3> | ||
<SchemaTable schema={defaultSchemas.integer} /> | ||
<h3>Number</h3> | ||
<SchemaTable schema={defaultSchemas.numberRange} /> | ||
<h3>String</h3> | ||
<SchemaTable schema={defaultSchemas.stringPattern} /> | ||
</Fragment> | ||
); | ||
export const arrayType = () => ( | ||
<Fragment> | ||
<h3>List Validation</h3> | ||
<SchemaTable schema={arraySchemas.listValidation} /> | ||
<h3>Tuple Validation</h3> | ||
<SchemaTable schema={arraySchemas.tupleValidation} /> | ||
<h3>Contains Validation</h3> | ||
<SchemaTable schema={arraySchemas.containsValidations} /> | ||
<h3>Additional Items Specification</h3> | ||
<SchemaTable schema={arraySchemas.additionalItems} /> | ||
<h3>Empty Array</h3> | ||
<SchemaTable schema={arraySchemas.emptyArray} /> | ||
</Fragment> | ||
); | ||
export const objectType = () => ( | ||
<Fragment> | ||
<h3>Simple Object</h3> | ||
<SchemaTable schema={objectSchemas.simpleObject} /> | ||
<h3>Property Specification</h3> | ||
<SchemaTable schema={objectSchemas.propertySpecification} /> | ||
<h3>Required Properties Specification</h3> | ||
<SchemaTable schema={objectSchemas.requiredProperties} /> | ||
<h3>Empty Object</h3> | ||
<SchemaTable schema={objectSchemas.emptyObject} /> | ||
</Fragment> | ||
); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Storybook utilizes configs in
.storybook/
folder (see #15 (comment)).Overall, this
config.js
file helps Storybook to work 🌈 .ℹ️ I've also tried customizing Storybook's webpack config to utilize Neutrino's webpack config, however, had come across some undesirable results.
full control mode
which returns a function instead of an object form (https://storybook.js.org/docs/configurations/custom-webpack-config/#webpack-customisation-modes)Since Storybook works fine even without hooking Neutrino's webpack config (and hooking Neutrino's webpack config would rather produce undesirable consequences), I think it's best we leave Storybook's config as-is.
Maybe if Storybook implements changes to use
storybook.config.js
to export a preset, we may be able to consider hooking webpack in the future, if necessary :)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.
Interesting! Thank you for the explanation, very helpful. I'll try to look into it soon and get back to you.