mirror of
https://github.com/BradNut/awesome-uses
synced 2025-09-08 17:40:31 +00:00
Person prop types
This commit is contained in:
parent
f3c0a97183
commit
1ffc5aee31
1 changed files with 23 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { name } from 'country-emoji';
|
import { name } from 'country-emoji';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Tag, Tags } from './Topics';
|
import { Tag, Tags } from './Topics';
|
||||||
|
|
@ -68,6 +69,28 @@ export default function Person({ person, currentTag }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Person.propTypes = {
|
||||||
|
currentTag: PropTypes.string,
|
||||||
|
person: PropTypes.shape({
|
||||||
|
github: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
url: PropTypes.string,
|
||||||
|
emoji: PropTypes.string,
|
||||||
|
description: PropTypes.string,
|
||||||
|
tags: PropTypes.arrayOf(PropTypes.string),
|
||||||
|
computer: PropTypes.oneOf(['apple', 'windows', 'linux']),
|
||||||
|
phone: PropTypes.oneOf(['iphone', 'android']),
|
||||||
|
twitter(props, propName, componentName) {
|
||||||
|
if (!/^@?(\w){1,15}$/.test(props[propName])) {
|
||||||
|
return new Error(
|
||||||
|
`Invalid prop \`${propName}\` supplied to` +
|
||||||
|
` \`${componentName}\`. This isn't a legit twitter handle.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
// Component Styles
|
// Component Styles
|
||||||
const PersonWrapper = styled.div`
|
const PersonWrapper = styled.div`
|
||||||
border: 1px solid var(--vape);
|
border: 1px solid var(--vape);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue