Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add defaultProps and propTypes to all components #47

Merged
merged 2 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/Calendar/Calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import styled from 'styled-components';
import { calendarFetch } from './CalendarFetch';

import EventWindow from './EventWindow.jsx';
import PropTypes from 'prop-types';

const DEFAULT_EVENT_WINDOW_WIDTH = 400;
const EVENT_WINDOW_H_OFFSET = 10;
Expand Down Expand Up @@ -214,4 +215,8 @@ Calendar.defaultProps = {
}
};

Calendar.propTypes = {
calendarStyle: PropTypes.objectOf(PropTypes.string)
};

export default Calendar;
15 changes: 15 additions & 0 deletions src/components/Calendar/CalendarField.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import styled from 'styled-components';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import PropTypes from 'prop-types';

const CalendarFieldContainer = styled.div`
display: flex;
Expand Down Expand Up @@ -117,4 +118,18 @@ class CalendarField extends React.Component {
}
}

CalendarField.defaultProps = {
text: "",
link: "",
className: "",
icon: "clock"
};

CalendarField.propTypes = {
text: PropTypes.string,
link: PropTypes.string,
className: PropTypes.string,
icon: PropTypes.string
};

export default CalendarField;
31 changes: 31 additions & 0 deletions src/components/Calendar/EventWindow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from 'styled-components';
import CalendarField from './CalendarField.jsx';

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import PropTypes from 'prop-types';

const Wrapper = styled.div`
word-wrap: break-word;
Expand Down Expand Up @@ -161,4 +162,34 @@ class EventWindow extends React.Component {
}
}

EventWindow.defaultProps = {
closeWindow: () => {},
eventClicked: {
url: "",
title: "",
start: new Date('January 1, 1970 00:00:00'),
end: new Date('January 1, 1970 00:00:00'),
hasTime: false,
location: "",
description: ""
},
hidden: true,
className: ""
};

EventWindow.propTypes = {
closeWindow: PropTypes.func,
eventClicked: PropTypes.shape({
url: PropTypes.string,
title: PropTypes.string,
start: PropTypes.instanceOf(Date),
end: PropTypes.instanceOf(Date),
hasTime: PropTypes.bool,
location: PropTypes.string,
description: PropTypes.string
}),
hidden: PropTypes.bool,
className: PropTypes.string
};

export default EventWindow;
12 changes: 11 additions & 1 deletion src/components/FAQ/Question.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import "../../utility/fonts.css";
import "../../index.css";
import { StaticP, StaticH1 } from "../../utility/ContentStyles.js";

import PropTypes from 'prop-types';

const Question = (props) => (
<React.Fragment>
Expand All @@ -11,4 +11,14 @@ const Question = (props) => (
</React.Fragment>
);

Question.defaultProps = {
question: "",
answer: ""
};

Question.propTypes = {
question: PropTypes.string,
answer: PropTypes.string
};

export default Question;
9 changes: 9 additions & 0 deletions src/components/StaticHeader/StaticHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import styled from 'styled-components';
import devices from '../../utility/MediaQueries.js';
import PropTypes from 'prop-types';

const Header = styled.h1`
font-family: "Roboto Condensed";
Expand All @@ -27,4 +28,12 @@ const StaticHeader = (props) => (
</HeaderOuter>
);

StaticHeader.defaultProps = {
children: ""
};

StaticHeader.propTypes = {
children: PropTypes.string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code here is kind of strange, not sure it's written this way. In general, we'd expect children to be just anything renderable (i.e. PropTypes.node), but here I agree that a string is what we want.

};

export default StaticHeader;
9 changes: 9 additions & 0 deletions src/components/SubpageOuter/SubpageOuter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styled from 'styled-components';
import devices from '../../utility/MediaQueries.js';

import StaticHeader from "../StaticHeader/StaticHeader.jsx";
import PropTypes from 'prop-types';

const Outer = styled.div`
width: 100%;
Expand All @@ -27,4 +28,12 @@ const SubpageOuter = (props) => (
</Outer>
);

SubpageOuter.defaultProps = {
header: ""
};

SubpageOuter.propTypes = {
header: PropTypes.string
};

export default SubpageOuter;
9 changes: 9 additions & 0 deletions src/components/Team/MemberCard.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import "../../utility/fonts.css";
import styled, { css } from 'styled-components';
import PropTypes from 'prop-types';

const specificResponsiveness = (...args) => css`@media all and (min-width: 214px) and (max-width: 600px) {${css(...args)};}`;

Expand Down Expand Up @@ -159,4 +160,12 @@ MemberCard.defaultProps = {
personalUrl: ""
};

MemberCard.propTypes = {
instagramUrl: PropTypes.string,
githubUrl: PropTypes.string,
linkedinUrl: PropTypes.string,
facebookUrl: PropTypes.string,
personalUrl: PropTypes.string,
};

export default MemberCard;