feature(components): prop-type Favicon

This commit is contained in:
Alexander Klein 2021-02-16 13:04:35 +01:00
parent 5b80b123fa
commit 9ab3d36ced

View File

@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import styles from './Favicon.module.css'; import styles from './Favicon.module.css';
function getHostName(url) { function getHostName(url) {
@ -6,7 +7,7 @@ function getHostName(url) {
return match && match.length > 1 ? match[1] : null; return match && match.length > 1 ? match[1] : null;
} }
export default function Favicon({ domain, ...props }) { function Favicon({ domain, ...props }) {
const hostName = domain ? getHostName(domain) : null; const hostName = domain ? getHostName(domain) : null;
return hostName ? ( return hostName ? (
@ -19,3 +20,9 @@ export default function Favicon({ domain, ...props }) {
/> />
) : null; ) : null;
} }
Favicon.propTypes = {
domain: PropTypes.string,
};
export default Favicon;