-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add classes to withStyles (#186)
- Loading branch information
1 parent
bed3dab
commit a34661e
Showing
13 changed files
with
110 additions
and
81 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,10 +1,40 @@ | ||
--- | ||
name: Home | ||
name: Examples | ||
route: / | ||
--- | ||
|
||
# Home | ||
import ColorBox from '../src/components/create-media-queries'; | ||
// import { ColorBox } from '@doc-kits/react'; | ||
|
||
Select a component from the sidebar menu to view example integrations of [Doc Kits: React](https://github.com/doc-kits/react) into Docz. | ||
<!-- | ||
You may change the statement above to import a different ColorBox | ||
component example from the 'src/components' directory. | ||
|
||
**Note:** View the `ColorBox` example code to see how you might override and extend a component's styles via the `withStyles` HOC. | ||
i.e. import ColorBox from 'src/components/styles-prop'; | ||
--> | ||
|
||
# Examples | ||
|
||
The [ColorBox](https://github.com/doc-kits/react/tree/master/src/ColorBox) component is used as an example, | ||
however, the process shown here is the same for any [Doc Kits: React](https://github.com/doc-kits/react) component. | ||
There are several variations of integration shown to highlight the different approaches. | ||
|
||
The examples show the following scenarios: | ||
|
||
- Direct integration | ||
- `withStyles` HOC | ||
- `withStyles` HOC Shorthand | ||
- `withStyles` HOC with Props | ||
- `styles` prop | ||
- Using Facepaint to create your own media queries | ||
|
||
You will find code for the variations in the `src/components/` folder. | ||
|
||
## ColorBox | ||
|
||
<div style={{ display: 'flex', justifyContent: 'space-between' }}> | ||
<ColorBox name="Red Barn" hex="#F00000" /> | ||
<ColorBox name="Cream Popsicle" hex="#F09320" /> | ||
<ColorBox name="Sky Blue" hex="#00AAE5" /> | ||
<ColorBox name="Lavender" hex="#977BB6" /> | ||
</div> |
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
import { withStyles, facepaint, ColorBox } from '@doc-kits/react'; | ||
|
||
const mq = facepaint([`@media(min-width: 400px)`, `@media(min-width: 600px)`]); | ||
|
||
export default withStyles({ | ||
wrapper: mq({ | ||
backgroundColor: ['black', 'red'], | ||
}), | ||
})(ColorBox); |
File renamed without changes.
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,14 @@ | ||
import { withStyles, ColorBox } from '@doc-kits/react'; | ||
|
||
export default withStyles({ | ||
// Overriding 'wrapper' and 'name' styles | ||
wrapper: { | ||
color: 'black', | ||
}, | ||
name: { | ||
fontWeight: '400', | ||
// Extending 'name' styles with 'text-transform' | ||
// 'textTransform' is not in default styles | ||
textTransform: 'lowercase', | ||
}, | ||
})(ColorBox); |
14 changes: 14 additions & 0 deletions
14
examples/docz/src/components/withstyles-hoc-props/index.js
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,14 @@ | ||
import { withStyles, ColorBox } from '@doc-kits/react'; | ||
|
||
export default withStyles({ | ||
// Overriding 'wrapper' and 'name' styles | ||
wrapper: { | ||
color: 'black', | ||
}, | ||
name: { | ||
fontWeight: '400', | ||
// Extending 'name' styles with 'text-transform' | ||
// 'textTransform' is not in default styles | ||
textTransform: 'lowercase', | ||
}, | ||
})(ColorBox); |
14 changes: 14 additions & 0 deletions
14
examples/docz/src/components/withstyles-hoc-shorthand/index.js
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,14 @@ | ||
import { withStyles, ColorBox } from '@doc-kits/react'; | ||
|
||
export default withStyles({ | ||
// Overriding 'wrapper' and 'name' styles | ||
wrapper: { | ||
color: 'black', | ||
}, | ||
name: { | ||
fontWeight: '400', | ||
// Extending 'name' styles with 'text-transform' | ||
// 'textTransform' is not in default styles | ||
textTransform: 'lowercase', | ||
}, | ||
})(ColorBox); |
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,14 @@ | ||
import { withStyles, ColorBox } from '@doc-kits/react'; | ||
|
||
export default withStyles({ | ||
// Overriding 'wrapper' and 'name' styles | ||
wrapper: { | ||
color: 'black', | ||
}, | ||
name: { | ||
fontWeight: '400', | ||
// Extending 'name' styles with 'text-transform' | ||
// 'textTransform' is not in default styles | ||
textTransform: 'lowercase', | ||
}, | ||
})(ColorBox); |
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