This repository has been archived by the owner on Oct 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
100,413 additions
and
49,852 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import "./buttons.css"; | ||
|
||
export const sharedButtonPropTypes = { | ||
isLink: PropTypes.bool, | ||
children: PropTypes.oneOfType( | ||
[ | ||
PropTypes.node, | ||
PropTypes.arrayOf( PropTypes.node ), | ||
] | ||
), | ||
onClick: PropTypes.func, | ||
href: PropTypes.string, | ||
}; | ||
|
||
export const sharedButtonDefaultProps = { | ||
isLink: false, | ||
children: null, | ||
onClick: null, | ||
href: null, | ||
}; | ||
|
||
/** | ||
* Creates a button component. | ||
* | ||
* @param {Object} props The props | ||
* @param {bool} props.isLink When true, Button will return an anchor <a> rather than a <button>. | ||
* | ||
* @returns {ReactElemen} The Button component. | ||
*/ | ||
const Button = ( props ) => { | ||
// Split Button.js specific props from all other props. | ||
const { | ||
children, | ||
className, | ||
isLink, | ||
...restProps | ||
} = props; | ||
|
||
if ( isLink ) { | ||
return <a | ||
className={ className } | ||
{ ...restProps } | ||
> | ||
{ children } | ||
</a>; | ||
} | ||
|
||
return <button | ||
className={ className } | ||
{ ...restProps } | ||
> | ||
{ children } | ||
</button>; | ||
}; | ||
|
||
Button.propTypes = { | ||
...sharedButtonPropTypes, | ||
className: PropTypes.string, | ||
}; | ||
|
||
Button.defaultProps = { | ||
...sharedButtonDefaultProps, | ||
className: "yoast-button", | ||
}; | ||
|
||
export default Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from "react"; | ||
import Button, { sharedButtonPropTypes, sharedButtonDefaultProps } from "./Button"; | ||
|
||
const closeIcon = <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 352 512" role="img" aria-hidden="true" focusable="false"> | ||
{ /* eslint-disable-next-line max-len */ } | ||
<path d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z" /> | ||
</svg>; | ||
|
||
/** | ||
* An Close button. | ||
* | ||
* @param {Object} props The props object. | ||
* | ||
* @returns {ReactElement} An Close button component. | ||
*/ | ||
export const CloseButton = ( props ) => { | ||
return <Button | ||
className="yoast-close" | ||
aria-label="Close" | ||
{ ...props } | ||
> | ||
{ closeIcon } | ||
</Button>; | ||
}; | ||
|
||
CloseButton.propTypes = { | ||
...sharedButtonPropTypes, | ||
}; | ||
|
||
CloseButton.defaultProps = { | ||
...sharedButtonDefaultProps, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from "react"; | ||
import Button, { sharedButtonPropTypes, sharedButtonDefaultProps } from "./Button"; | ||
|
||
/** | ||
* A primary button. | ||
* | ||
* @param {Object} props The props object. | ||
* | ||
* @returns {ReactElement} A primary button component. | ||
*/ | ||
export const PrimaryButton = ( props ) => { | ||
return <Button | ||
className="yoast-button yoast-button--primary" | ||
{ ...props } | ||
/>; | ||
}; | ||
|
||
PrimaryButton.propTypes = { | ||
...sharedButtonPropTypes, | ||
}; | ||
|
||
PrimaryButton.defaultProps = { | ||
...sharedButtonDefaultProps, | ||
}; |
Oops, something went wrong.