fix(footer): prop types checks
This commit is contained in:
committed by
mrugesh mohapatra
parent
26d09fbab1
commit
48aa09db38
@ -6,9 +6,7 @@ import { Grid, Row, Col } from '@freecodecamp/react-bootstrap';
|
|||||||
import './footer.css';
|
import './footer.css';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
children: PropTypes.any,
|
children: PropTypes.any
|
||||||
external: PropTypes.bool,
|
|
||||||
to: PropTypes.string.isRequired
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ColHeader = ({ children, ...other }) => (
|
const ColHeader = ({ children, ...other }) => (
|
||||||
@ -18,8 +16,14 @@ const ColHeader = ({ children, ...other }) => (
|
|||||||
);
|
);
|
||||||
ColHeader.propTypes = propTypes;
|
ColHeader.propTypes = propTypes;
|
||||||
|
|
||||||
|
const linkPropTypes = {
|
||||||
|
children: PropTypes.any,
|
||||||
|
external: PropTypes.bool,
|
||||||
|
to: PropTypes.string.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
const Link = ({ children, to, external, ...other }) => {
|
const Link = ({ children, to, external, ...other }) => {
|
||||||
if (!external && /^\/(?!\/)/.test(to)) {
|
if (!external && /^\/[^/]?/.test(to)) {
|
||||||
return (
|
return (
|
||||||
<GatsbyLink to={to} {...other}>
|
<GatsbyLink to={to} {...other}>
|
||||||
{children}
|
{children}
|
||||||
@ -33,7 +37,7 @@ const Link = ({ children, to, external, ...other }) => {
|
|||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Link.propTypes = propTypes;
|
Link.propTypes = linkPropTypes;
|
||||||
|
|
||||||
function Footer() {
|
function Footer() {
|
||||||
return (
|
return (
|
||||||
@ -55,7 +59,7 @@ function Footer() {
|
|||||||
<p>
|
<p>
|
||||||
Donations to freeCodeCamp go toward our education initiatives, and
|
Donations to freeCodeCamp go toward our education initiatives, and
|
||||||
help pay for servers, services, and staff. You can
|
help pay for servers, services, and staff. You can
|
||||||
<Link className='inline' href='https://donate.freecodecamp.org'>
|
<Link className='inline' to='https://donate.freecodecamp.org'>
|
||||||
make a tax-deductible donation here
|
make a tax-deductible donation here
|
||||||
</Link>
|
</Link>
|
||||||
.
|
.
|
||||||
|
Reference in New Issue
Block a user