<img width="100" height="140" align="right" alt="Sponsored by Amplifr" src="https://amplifr-direct.s3-eu-west-1.amazonaws.com/social_images/image/37b580d9-3668-4005-8d5a-137de3a3e77c.png" />
Uibook is a tool for visual testing of React components. It let you quickly check both desktop and mobile view of your components with real media queries and different combinations of props.
The Key Features:
:triangular_flag_on_post: Check amazing Uibook example here: https://amplifr.com/uikit.
We’ve designed Uibook for seamless integration to your project. Install it as a webpack plugin, and you’re all set: Uibook doesn’t require any separate bundler.
webpack.config.js
const UibookPlugin = require('uibook/plugin')
module.exports = {
…
plugins: [
new UibookPlugin({
outputPath: '/uibook',
controller: path.join(__dirname, '../src/uibook-controller.js'),
hot: true
})
],
}
Read more about installation → Install in Create React App using CRACO →
You should define two things only:
button.uibook.js
import UibookCase from 'uibook/case'
import Button from '../src/button'
export default {
component: Button,
cases: [
() => <UibookCase>Button</UibookCase>,
() => <UibookCase props={{ isSmall: true }}>Small button</UibookCase>
]
}
Read more about configuration →
As soon as you finished your first Uibook Page, you’re ready to write Uibook Controller. This is a place where all Pages included and passed to UibookStarter :sparkles:
uibook-controller.js
import UibookStarter from 'uibook/starter'
import ButtonUibook from './button.uibook'
export default UibookStarter({
pages: {
Button: ButtonUibook
}
})
There is no need in any additional servers or webpack instances.
Uibook integrates into your project, so just run your bundler
and open /uibook
(or your custom address — outputPath
) in a browser.
This mode enables contentEditable
for each case, allowing managers,
designers and interface editors to preview content in components.
Anyone is welcomed to contribute, you can check current tasks in PLAN.md. I would be glad to answer your questions about the project.