This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(styleguide): implement styleguidist
this adds the styleguidist lib to the project to generate the style guide docs
- Loading branch information
Showing
8 changed files
with
963 additions
and
38 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const FavoriteButton = require('../src/components/FavoriteButton'); | ||
|
||
Is Favorited: | ||
|
||
<FavoriteButton isFavorited /> | ||
|
||
Not Favorited: | ||
|
||
<FavoriteButton /> | ||
|
||
You can handle the onclick method to fire the API call to record the users preference to favorite an object. |
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,19 @@ | ||
Enabled Pagination: | ||
|
||
<PaginationControl totalItems={20} perPage={5} /> | ||
|
||
Disabled Pagination: | ||
|
||
<PaginationControl totalItems={20} perPage={5} controlsDisabled={true} /> | ||
|
||
Handle the pagination of the resource with navigateToPage. An example of usage: | ||
|
||
```javascript | ||
navigateToPage(page) { | ||
this.setState({ currentNotes: this.getNotes(page) }); | ||
} | ||
|
||
getNotes(pageNum) { | ||
return this.state.allNotes.slice( pageNum * this.state.perPage - this.state.perPage, pageNum * this.state.perPage); | ||
} | ||
````` |
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,72 @@ | ||
const path = require('path') | ||
const cssnext = require('postcss-cssnext') | ||
const autoprefixer = require('autoprefixer') | ||
const impy = require('postcss-import') | ||
const neat = require('postcss-neat') | ||
const rucksack = require('rucksack-css') | ||
|
||
const PATHS = { | ||
app: './src/index.js', | ||
dist: path.join(__dirname, 'dist'), | ||
html: './src/index.html', | ||
}; | ||
const dir = path.join(__dirname, 'src'); | ||
module.exports = { | ||
title: 'Octagon Style Guide', | ||
components: './src/components/**/*.jsx', | ||
getExampleFilename(componentpath) { | ||
return componentpath.replace(/\.jsx?$/, '.examples.md'); | ||
}, | ||
getComponentPathLine(componentPath) { | ||
const name = path.basename(componentPath, '.jsx'); | ||
const dir = path.dirname(componentPath); | ||
return 'import ' + name + ' from ../src/components/' + name + ';' ; | ||
|
||
}, | ||
skipComponentsWithoutExample: true, | ||
webpackConfig: { | ||
entry: [ | ||
path.join(__dirname, './semantic/dist/semantic.css'), | ||
path.join(__dirname, './src/styles/components/pagination-control.css'), | ||
path.join(__dirname, './src/styles/app.css'), | ||
], | ||
output: { | ||
path: PATHS.dist, | ||
publicPath: "/", | ||
filename: "bundle.js" | ||
}, | ||
module: { | ||
preLoaders: [ | ||
{ | ||
test: /\.(js|jsx)$/, | ||
loaders: ["babel-loader"], | ||
exclude: /node_modules/ | ||
} | ||
], | ||
loaders: [ | ||
{ | ||
test: /\.(jpe?g|png|gif|svg)$/i, | ||
loader: 'file?name=[name].[ext]' | ||
}, | ||
{ | ||
test: /\.css?$/, | ||
loaders: [ 'style-loader', 'css-loader?importLoaders=1', 'postcss-loader' ] | ||
|
||
}, | ||
{ | ||
test: /\.(ttf|otf|eot|woff(2)?)(\?[a-z0-9]+)?$/, | ||
loader: 'file-loader?name=fonts/[name].[ext]' | ||
} | ||
] | ||
}, | ||
resolve: { | ||
extensions: ['', '.js', '.jsx'], | ||
}, | ||
postcss: function () { | ||
return { | ||
defaults: [impy, cssnext, neat, rucksack], | ||
cleaner: [autoprefixer({ browsers: ['last 2 version'] })] | ||
} | ||
} | ||
} | ||
}; |
Oops, something went wrong.