Skip to content

Commit

Permalink
Merge branch 'hotfix-fix-props' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
w3aseL committed Aug 12, 2020
2 parents 1498542 + b01f77e commit c002bc5
Show file tree
Hide file tree
Showing 15 changed files with 360 additions and 564 deletions.
100 changes: 38 additions & 62 deletions src/components/Button/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,68 +16,6 @@ class Button extends React.Component {
super(props)
}

static propTypes = {
/**
* The button's children elements. Usually text!
*/
children: PropTypes.node,
/**
* Color of the button. [primary, secondary, info, success, danger, warning]
*/
color: PropTypes.string.isRequired,
/**
* Size of the button. [sm, lg]
*/
size: PropTypes.string,
/**
* Determines if the button is active.
*/
active: PropTypes.bool.isRequired,
/**
* Determines if the button is disabled.
*/
disabled: PropTypes.bool.isRequired,
/**
* The function to fire on button click.
*/
onClick: PropTypes.func,
/**
* Changes the button to a simple style.
*/
simple: PropTypes.simple,
/**
* Changes the button to a rounded style.
*/
round: PropTypes.bool,
/**
* Makes the button into a link button.
*/
link: PropTypes.bool,
/**
* Sets the target link for a button.
*/
href: PropTypes.string,
/**
* Sets the icon of a button. Can be used in junction with children.
*/
icon: PropTypes.node,
/**
* Sets the href target of a button.
*/
target: PropTypes.string,
/**
* Sets the social media of choice for the button. Overrides color.
*
* List: [ twitter, facebook, google, linkedin, pinterest, youtube, tumblr, github, behance, dribble, reddit ]
*/
social: PropTypes.string
}

static defaultProps = {
active: false,
disabled: false
}

getIconClassBySocial = social => {
switch(social) {
case "twitter":
Expand Down Expand Up @@ -126,6 +64,44 @@ class Button extends React.Component {
}
}

Button.propTypes = {
/** The button's children elements. Usually text! */
children: PropTypes.node,
/** Color of the button. [primary, secondary, info, success, danger, warning] */
color: PropTypes.string.isRequired,
/** Size of the button. [sm, lg] */
size: PropTypes.string,
/** Determines if the button is active. */
active: PropTypes.bool.isRequired,
/** Determines if the button is disabled. */
disabled: PropTypes.bool.isRequired,
/** The function to fire on button click. */
onClick: PropTypes.func,
/** Changes the button to a simple style. */
simple: PropTypes.simple,
/** Changes the button to a rounded style. */
round: PropTypes.bool,
/** Makes the button into a link button. */
link: PropTypes.bool,
/** Sets the target link for a button. */
href: PropTypes.string,
/** Sets the icon of a button. Can be used in junction with children. */
icon: PropTypes.node,
/** Sets the href target of a button. */
target: PropTypes.string,
/**
* Sets the social media of choice for the button. Overrides color.
*
* List: [ twitter, facebook, google, linkedin, pinterest, youtube, tumblr, github, behance, dribble, reddit ]
*/
social: PropTypes.string
}

Button.defaultProps = {
active: false,
disabled: false
}

export { Button }

export default Button
56 changes: 21 additions & 35 deletions src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,6 @@ class Card extends React.Component {
super(props)
}

static propTypes = {
/**
* The header of the card.
*/
header: PropTypes.node,
/**
* The footer of the card.
*/
footer: PropTypes.node,
/**
* The body of the card.
*/
children: PropTypes.node.isRequired,
/**
* The source of the header image.
*/
imgSrc: PropTypes.string,
/**
* The width of the card.
*/
width: PropTypes.string,
/**
* Other style options of the card.
*/
style: PropTypes.object,
/**
* The color of the card.
*/
color: PropTypes.string
}

static defaultProps = {
style: {}
}

render() {
const { header, footer, children, imgSrc, width, style, color } = this.props

Expand All @@ -89,6 +54,27 @@ class Card extends React.Component {
}
}

Card.propTypes = {
/** The header of the card. */
header: PropTypes.node,
/** The footer of the card. */
footer: PropTypes.node,
/** The body of the card. */
children: PropTypes.node.isRequired,
/** The source of the header image. */
imgSrc: PropTypes.string,
/** The width of the card. */
width: PropTypes.string,
/** Other style options of the card. */
style: PropTypes.object,
/** The color of the card. */
color: PropTypes.string
}

Card.defaultProps = {
style: {}
}

export { Card }

export default Card
38 changes: 15 additions & 23 deletions src/components/Checkbox/Checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,6 @@ class Checkbox extends React.Component {
super(props)
}

static propTypes = {
/**
* The label text.
*/
label: PropTypes.string,
/**
* Function to handle change.
*/
onChange: PropTypes.func,
/**
* Sets whether the checkbox is enabled or disabled.
*/
disabled: PropTypes.bool,
/**
* Sets whether the checkbox is inline or not.
*/
inline: PropTypes.bool
}

static defaultProps = {
label: "Default text!"
}

render() {
const { label, onChange, disabled, inline } = this.props

Expand All @@ -77,6 +54,21 @@ class Checkbox extends React.Component {
}
}

Checkbox.propTypes = {
/** The label text. */
label: PropTypes.string,
/** Function to handle change. */
onChange: PropTypes.func,
/** Sets whether the checkbox is enabled or disabled. */
disabled: PropTypes.bool,
/** Sets whether the checkbox is inline or not. */
inline: PropTypes.bool
}

Checkbox.defaultProps = {
label: "Default text!"
}

export { Checkbox }

export default Checkbox
56 changes: 22 additions & 34 deletions src/components/Dropdown/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,6 @@ class Dropdown extends React.Component {
super(props)
}

static propTypes = {
/**
* Show a caret on the toggle.
*/
caret: PropTypes.bool,
/**
* Label for the dropdown button.
*/
label: PropTypes.string.isRequired,
/**
* The options for the dropdown.
*/
options: PropTypes.array.isRequired,
/**
* Sets the color of the dropdown.
*/
color: PropTypes.string,
/**
* Sets if the dropdowns can be inline.
*/
inline: PropTypes.bool,
/**
* Direction of the dropdown.
*/
direction: PropTypes.string
}

static defaultProps = {
label: "Dropdown",
options: [
{ label: "Default Item" }
]
}

render() {
const { caret, label, options, color, inline, direction } = this.props

Expand All @@ -84,6 +50,28 @@ class Dropdown extends React.Component {
}
}

Dropdown.propTypes = {
/** Show a caret on the toggle. */
caret: PropTypes.bool,
/** Label for the dropdown button. */
label: PropTypes.string.isRequired,
/** The options for the dropdown. */
options: PropTypes.array.isRequired,
/** Sets the color of the dropdown. */
color: PropTypes.string,
/** Sets if the dropdowns can be inline. */
inline: PropTypes.bool,
/** Direction of the dropdown. */
direction: PropTypes.string
}

Dropdown.defaultProps = {
label: "Dropdown",
options: [
{ label: "Default Item" }
]
}

export { Dropdown }

export default Dropdown
68 changes: 26 additions & 42 deletions src/components/InfoArea/InfoArea.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,48 +30,6 @@ class InfoArea extends React.Component {
super(props)
}

static propTypes = {
/**
* Color of the blob for the info area
*/
color: PropTypes.string,
/**
* Icon for the blob to use
*/
icon: PropTypes.node.isRequired,
/**
* Title of the info area. REQUIRED
*/
title: PropTypes.string.isRequired,
/**
* Description of the info area.
*/
description: PropTypes.string,
/**
* Color of the icon.
*/
iconColor: PropTypes.string,
/**
* Determines if the icon and blob will hover vertically over text.
*/
hover: PropTypes.bool.isRequired,
/**
* An appendable object. Usually a button link.
*/
append: PropTypes.node,
/**
* Hides the blob. No need for the color prop if the blob is hidden!
*/
noBlob: PropTypes.bool
}

static defaultProps = {
color: "black",
icon: <i className="tim-icons icon-html5" />,
iconColor: "primary",
hover: true
}

/**
* getBlobByColor
* ===========
Expand Down Expand Up @@ -126,6 +84,32 @@ class InfoArea extends React.Component {
}
}

InfoArea.propTypes = {
/** Color of the blob for the info area */
color: PropTypes.string,
/** Icon for the blob to use */
icon: PropTypes.node.isRequired,
/** Title of the info area. REQUIRED */
title: PropTypes.string.isRequired,
/** Description of the info area. */
description: PropTypes.string,
/** Color of the icon. */
iconColor: PropTypes.string,
/** Determines if the icon and blob will hover vertically over text. */
hover: PropTypes.bool.isRequired,
/** An appendable object. Usually a button link. */
append: PropTypes.node,
/** Hides the blob. No need for the color prop if the blob is hidden! */
noBlob: PropTypes.bool
}

InfoArea.defaultProps = {
color: "black",
icon: <i className="tim-icons icon-html5" />,
iconColor: "primary",
hover: true
}

export { InfoArea }

export default InfoArea
Loading

0 comments on commit c002bc5

Please sign in to comment.