The aim of this library is to provide a toolbelt of components, that will allow us to compose sites together more quickly and consistently.
One of the main challenges is providing the required flexibility.
The TraitsProvider
component allows us to set our own themes and defaults.
We can manage the look of most components via various props, and even have custom styles injected into them via the styles
prop.
A few breaking changes were introduced in 1.0.0
that need to be considered on the following components:
-
Changes from
styles
object (e.g.styles = { ... }
) to use nested keys, e.g.{ root: { ... }, outer: { ... } }
-
Removed nested
styles
object weirdness. So instead of:{ wrapper: { content: { ... }, overlay: { ... } }, container: { ... }, close: { ... } }
It is now:
{ content: { ... }, overlay: { ... }, container: { ... }, close: { ... } }
-
Change
styles.form
tostyles.root
for consistency. -
Change
styles.background
tostyles.root
for consistency.
Constructicon now uses Emotion as it's CSS in JS solution. There are a few small things you will need to do to ensure your CSS is compatible.
- Any child CSS selectors are required to be prefixed with an
&
e.g.'& > div'
,&:hover
- Define your keyframes in their own object and pass them into withStyles, which will then pass your computed keyframes back to your styles function e.g. see components/icon/styles.js
- If you are using your own renderDocument function, renderServerCSS is now a function that takes your server rendered string of HTML, and returns an updated HTML string with the required styles inlined in the markup
yarn
to install dependenciesyarn start
to generate and serve style guideyarn test
to run tests (linting and unit tests)yarn run test:lint
to run lintingyarn run test:unit
to run unit testsyarn run build
to build for productionyarn run build:styleguide
to build the styleguideyarn run build:icons
to minify and prepare the icons to import intoicons.js
. See more below.yarn playground:build
to build webpack for the local development serveryarn playground:start
to start the local development server
We are aiming to build from the ground up with tests where appropriate, using Mocha, Chai and Enzyme.
To execute the tests, simply run yarn test
.
The icon set is maintained in a Sketch file, which is setup to export individual SVG files for each icon to the icons directory.
After exporting from Sketch, run yarn run build:icons
to minify SVGs and concatenate into a single file to grab the path data to import into icons.js
.