-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #760 from neontribe/styleguide
feat: add styleguide
- Loading branch information
Showing
42 changed files
with
2,263 additions
and
1,039 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 |
---|---|---|
|
@@ -27,4 +27,5 @@ Box.propTypes = { | |
...createPropTypes(border.propNames), | ||
}; | ||
|
||
/** @component */ | ||
export default Box; |
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 @@ | ||
### Implements | ||
|
||
* [space](https://styled-system.com/api#space) | ||
* [color](https://styled-system.com/api#color) | ||
* [layout](https://styled-system.com/api#layout) | ||
* [flexbox](https://styled-system.com/api#flexbox) | ||
* [position](https://styled-system.com/api#position) | ||
* [border](https://styled-system.com/api#border) | ||
|
||
### Usage | ||
|
||
```jsx | ||
<Box | ||
width={[1, 1 / 2]} | ||
p={3} | ||
borderWidth={2} | ||
borderStyle="solid" | ||
>Content here!</Box> | ||
``` |
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 Box from './Box'; | ||
|
||
export default Box; |
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 @@ | ||
### Primary | ||
|
||
```jsx | ||
<Button>Click me!</Button> | ||
``` | ||
|
||
### Seconary | ||
|
||
```jsx | ||
<Button variant="secondary">Click me!</Button> | ||
``` | ||
|
||
### Link | ||
|
||
The most common use can would be combine the `link` variant with `as="a"` to render the component as an anchor element. | ||
|
||
```jsx | ||
<Button as="a" href="" variant="link">Click me!</Button> | ||
``` |
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 Button from './Button'; | ||
|
||
export default Button; |
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,17 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
/** @visibleName Conditional Wrap */ | ||
const ConditionalWrap = ({ condition, children, wrap }) => | ||
condition ? React.cloneElement(wrap(children)) : children; | ||
|
||
ConditionalWrap.propTypes = { | ||
/** The condition to pass for `children` to be wrappe */ | ||
condition: PropTypes.bool.isRequired, | ||
/** ender prop with `children` as the only argument. Invoked when the `condition` is true */ | ||
wrap: PropTypes.func.isRequired, | ||
children: PropTypes.node.isRequired, | ||
}; | ||
|
||
/** @component */ | ||
export default ConditionalWrap; |
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,15 @@ | ||
An abstraction which makes it simple to conditionally wrap content, whilst avoiding a duplicated definition of the content. | ||
|
||
### Usage | ||
|
||
In this scenario the content would be wrapped inside a modal, but only for mobile devices. | ||
|
||
```jsx static | ||
<ConditionalWrap | ||
condition={isMobile} | ||
wrap={children => <Modal>{children}</Modal>} | ||
children={ | ||
<p>Content here!</p> | ||
} | ||
/> | ||
``` |
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 ConditionalWrap from './ConditionalWrap'; | ||
|
||
export default ConditionalWrap; |
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 @@ | ||
```jsx | ||
<Divider /> | ||
``` |
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 Divider from './Divider'; | ||
|
||
export default Divider; |
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,20 @@ | ||
```jsx | ||
import Button from '../Button'; | ||
import Spacer from '../Spacer'; | ||
|
||
const [isVisible, setIsVisible] = React.useState(false); | ||
|
||
<> | ||
<Button onClick={() => setIsVisible(true)}>Open drawer</Button> | ||
<Drawer | ||
visible={isVisible} | ||
animateFrom="right" | ||
> | ||
<p>Drawer content here!</p> | ||
|
||
<Spacer mt={3} /> | ||
|
||
<Button onClick={() => setIsVisible(false)}>Close drawer</Button> | ||
</Drawer> | ||
</> | ||
``` |
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 Drawer from './Drawer'; | ||
|
||
export default Drawer; |
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,7 @@ | ||
Implements [FontAwesomeIcon](https://github.com/FortAwesome/react-fontawesome). | ||
|
||
```jsx | ||
import { faBars } from '@fortawesome/free-solid-svg-icons'; | ||
|
||
<Icon icon={faBars} size="2x" /> | ||
``` |
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 Icon from './Icon'; | ||
|
||
export default Icon; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```jsx | ||
<Logo /> | ||
``` |
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,13 @@ | ||
```jsx | ||
<Notification> | ||
Please wait whilst we fetch some data… | ||
</Notification> | ||
``` | ||
|
||
### Allow close | ||
|
||
```jsx | ||
<Notification allowClose> | ||
Please wait whilst we fetch some data… | ||
</Notification> | ||
``` |
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 Notification from './Notification'; | ||
|
||
export default Notification; |
Oops, something went wrong.
da4908d
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.
Successfully deployed to following URLs: