Skip to content

Commit

Permalink
Demo prez stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Young committed Apr 16, 2018
1 parent 8cc8b11 commit e7ac0a6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
35 changes: 34 additions & 1 deletion demo/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { generateDocs } from 'react-doc-props';

import { documentation } from './PropDemo';

export const documentationString = `
const documentationString = `
import { string, number, shape, arrayOf, setComponentProps } from 'react-doc-props';
export const documentation = {
Expand Down Expand Up @@ -72,6 +72,34 @@ export const documentation = {
setComponentProps(documentation, PropDemo);
`;

const propTypesString = `
import PropTypes from 'prop-types';
PropDemo.propTypes = {
username: PropTypes.string,
age: PropTypes.number,
post: PropTypes.shape({
content: PropTypes.string.isRequired,
likes: PropTypes.number.isRequired,
category: PropTypes.shape({
name: PropTypes.string,
number: PropTypes.number
})
}).isRequired,
friends: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.number,
name: PropTypes.string
})
)
};
PropDemo.defaultProps = {
username: 'Name not set',
friends: []
};
`

class App extends Component {
render() {
return (
Expand All @@ -87,6 +115,11 @@ class App extends Component {
mode: 'javascript',
readOnly: 'true'
}} />
<p>...and is equivalent to the following...</p>
<CodeMirror value={propTypesString} options={{
mode: 'javascript',
readOnly: 'true'
}} />
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion demo/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ body {
padding: 20px;
font-family: Raleway, sans-serif;
font-size: 1.2em;
background: linear-gradient(20deg, rgb(219, 112, 147), #daa357);
background: linear-gradient(20deg, #FFC0AC, #5789CC);
}

p {
Expand Down

0 comments on commit e7ac0a6

Please sign in to comment.