This file contains hidden or 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 Badge from './components/Badge'; | |
| import Table from './ui/Table'; | |
| import './App.css'; | |
| import propTypesToObject from './helpers/propTypesToObject'; | |
| const propTypes = propTypesToObject({ | |
| propTypes: Badge.propTypes | |
| }); |
This file contains hidden or 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> | |
| </tr> |
This file contains hidden or 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 this to check each of the component's PropTypes against | |
| import PropTypes from 'prop-types'; | |
| // helper method to determine whether a propType method is a particular PropType validator | |
| const isCorrectPropType = (method, propType) => | |
| method === PropTypes[propType] || method === PropTypes[propType].isRequired; | |
| // helper method to determine whether a prop is required or not - if it is required, | |
| // it'll be equal to the .isRequired method on the propType. | |
| const isPropTypeRequired = (method, propType) => method === PropTypes[propType].isRequired; |
This file contains hidden or 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 Badge from './components/Badge'; | |
| import Table from './ui/Table'; | |
| import './App.css'; | |
| const App = props => ( | |
| <div className="app"> | |
| <Badge | |
| withHeading | |
| heading="Hello Darkness"> |
This file contains hidden or 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 './Table.css'; | |
| const Table = ({ propTypes }) => ( | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>Name</th> | |
| <th>Type</th> | |
| <th>Required?</th> |
This file contains hidden or 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 Badge from './components/Badge'; | |
| import './App.css'; | |
| const App = props => ( | |
| <div className="app"> | |
| <Badge | |
| withHeading | |
| heading="Hello Darkness"> | |
| My Old Friend |
This file contains hidden or 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 './Badge.css'; | |
| const Badge = ({ withHeading, heading, children }) => ( | |
| <div className="badge"> | |
| {withHeading && ( | |
| <span className="badge-heading">{heading}</span> | |
| )} | |
| {children} |
This file contains hidden or 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'; | |
| export const Nav = React.createClass({ | |
| componentDidMount: function () { | |
| analytics.track('Nav Mounted'); | |
| }, | |
| handleLogoClick: function (evt) { | |
| evt.preventDefault(); | |
| analytics.track('Logo Clicked'); | |
| }, |
This file contains hidden or 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
| function enzyme() { | |
| mocha --grep $1 src/**/*.spec.js | |
| } |
This file contains hidden or 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
| module Mermaid | |
| module DeliveryHelper | |
| cached = expensive_function_that_i_dont_want_to_run_each_time(params | |
| def method_one | |
| cached[:title] | |
| end | |
| def method_two | |
| cached[:iso] |