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
const Grid = () => ( | |
<Row> | |
<Col>I am a Col</Col> | |
<Col>I am a Col</Col> | |
<Col>I am a Col</Col> | |
<Col>I am a Col</Col> | |
<Col>I am a Col</Col> | |
<Col>I am a Col</Col> | |
<Col>I am a Col</Col> | |
<Col>I am a Col</Col> |
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
import React from 'react' | |
import Animation from 'invision-helios/lib/Animation' | |
class Parent extends React.Component { | |
state = { | |
hovered: false | |
} | |
onHover = () => { | |
this.setState({ hovered: !this.state.hover }) |
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
components/ | |
- Logo/ | |
--- Logo.js | |
--- Logo.spec.js | |
--- Logo.css | |
--- index.js | |
- MainNavigation/ | |
--- MainNavigation.js | |
--- MainNavigation.spec.js | |
--- MainNavigation.css |
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
QuoteAndCTA/_styles.scss: | |
.bnc-quote-and-cta { | |
@extend %padded-bottom-big; | |
@extend %padded-top-big; | |
text-align: center; | |
&__quote { | |
@extend %text-giga; | |
@extend %spaced-bottom-small; |
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
<div class="form-wrapper"> | |
<form id="my-form" action="/posts/new" method="post"> | |
<input id="name" name="name" type="text" /> | |
<button type="submit">Submit</button> | |
</form> | |
</div> | |
<div class="totally-different-element"> | |
<input form="my-form id="password" name="password" type="text" /> | |
<!-- this will still be part of the form data when submitted 😱 --> | |
</div> |
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
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
export const oneOfProps = { | |
colour: ['red', 'green', 'blue'], | |
size: ['small', 'medium', 'large'] | |
}; | |
export const propTypes = { | |
name: PropTypes.string.isRequired, |
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
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import './Table.css'; | |
const getRows = propTypes => Object.keys(propTypes).map(prop => ( | |
<tr key={prop}> | |
<td>{prop}</td> | |
<td>{propTypes[prop].type}</td> | |
<td>{propTypes[prop].required.toString()}</td> | |
<td>{propTypes[prop].description}</td> |
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
import React from 'react'; | |
import deepAssign from 'deep-assign'; | |
import Badge from './components/Badge'; | |
import data from './data'; | |
import Table from './ui/Table'; | |
import './App.css'; | |
import propTypesToObject from './helpers/propTypesToObject'; | |
import propTypesToDescriptions from './helpers/propTypesToDescriptions'; | |
const propTypes = propTypesToObject({ |
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
const propTypesToDescriptions = ({ propTypes, data }) => Object.keys(propTypes).reduce((obj, curr) => ({ | |
...obj, | |
[curr]: { | |
description: data[curr] | |
} | |
}), {}); | |
export default propTypesToDescriptions; |
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
export default { | |
propTypes: { | |
Badge: { | |
withHeading: 'Whether we should show some additional messaging within the Badge.', | |
heading: 'If withHeading is true, this is the content of the additional messaging that will be shown.', | |
children: 'The main content of the Badge.' | |
} | |
} | |
} |