Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/14.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
igorschoester committed Jun 22, 2020
2 parents aa6c676 + bea5c93 commit e688425
Show file tree
Hide file tree
Showing 33 changed files with 100,413 additions and 49,852 deletions.
65 changes: 64 additions & 1 deletion apps/components/ReactifiedComponentsWrapper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
import React from "react";
import React, { Fragment } from "react";
import TextInput from "@yoast/components/src/inputs/TextInput";
import TextArea from "@yoast/components/src/inputs/TextArea";
import CheckboxGroup from "@yoast/components/src/checkbox/CheckboxGroup";
import RadioButtonGroup from "@yoast/components/src/radiobutton/RadioButtonGroup";
import { MultiSelect, Select } from "@yoast/components/src/select/Select";
import Toggle from "@yoast/components/src/toggle/Toggle";
import DataModel from "@yoast/components/src/data-model/DataModel";
import {
Button,
PrimaryButton,
SecondaryButton,
UpsellButton,
HideButton,
RemoveButton,
CloseButton,
} from "@yoast/components/src/button";

/**
* Temporary onclick function.
*
* @returns {void}
*/
function clickerDiClick() {
console.log( "You are an exceptional clicker!" );
}

const buttonGrouping = <Fragment>
<Button title="Testing whether other props">Naked button</Button>
<PrimaryButton onClick={ clickerDiClick } title="Other props work!">Primary button</PrimaryButton>
<PrimaryButton href="#" isLink={ true } title="Other props work!">Primary link</PrimaryButton>
<SecondaryButton onClick={ clickerDiClick } title="Other props work!">Secondary button</SecondaryButton>
<SecondaryButton href="#" isLink={ true } title="Other props work!">Secondary link</SecondaryButton>
<UpsellButton onClick={ clickerDiClick } title="Other props work!">Upsell button</UpsellButton>
<UpsellButton href="#" isLink={ true } title="Other props work!">Upsell link</UpsellButton>
<UpsellButton onClick={ clickerDiClick } caret={ true } title="Other props work!">Upsell button</UpsellButton>
<UpsellButton href="#" isLink={ true } caret={ true } title="Other props work!">Upsell link</UpsellButton>
<HideButton onClick={ clickerDiClick } title="Other props work!">Hide button</HideButton>
<HideButton href="#" isLink={ true } title="Other props work!">Hide link</HideButton>
<RemoveButton onClick={ clickerDiClick } title="Other props work!">Remove button</RemoveButton>
<RemoveButton href="#" isLink={ true } title="Other props work!">Remove link</RemoveButton>
<CloseButton onClick={ clickerDiClick } title="Other props work!" />
<CloseButton href="#" isLink={ true } title="Other props work!" />
</Fragment>;

/**
* Function that displays all the reactified components that we currently have.
Expand All @@ -15,6 +51,30 @@ import DataModel from "@yoast/components/src/data-model/DataModel";
const ReactifiedComponentsWrapper = () => {
return (
<div className="yoast">

<h2>Buttons</h2>
<h3>Row</h3>
<div
style={ {
padding: "24px",
} }
>
{ buttonGrouping }
</div>

<h3>Column</h3>
<div
style={ {
display: "flex",
flexDirection: "column",
padding: "24px",
} }
>
{ buttonGrouping }
</div>
<hr />

<h2>Inputs</h2>
<TextInput
label="This is the input label"
value="This is the input value"
Expand Down Expand Up @@ -147,6 +207,9 @@ const ReactifiedComponentsWrapper = () => {
linkText="A helpful link!"
onChange={ console.warn }
/>
<hr />

<h2>DataModel</h2>
<DataModel
items={ [
{
Expand Down
14 changes: 7 additions & 7 deletions apps/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoast/example-component-app",
"version": "1.0.66",
"version": "1.0.67-rc.0",
"description": "This app demonstrates the possibilites of our components",
"main": "index.js",
"author": "Yoast",
Expand All @@ -12,11 +12,11 @@
},
"dependencies": {
"@wordpress/i18n": "1.2.3",
"@yoast/analysis-report": "^1.5.0",
"@yoast/components": "^2.3.0",
"@yoast/configuration-wizard": "^2.5.0",
"@yoast/analysis-report": "^1.6.0-rc.0",
"@yoast/components": "^2.4.0-rc.0",
"@yoast/configuration-wizard": "^2.6.0-rc.0",
"@yoast/helpers": "^0.12.1",
"@yoast/search-metadata-previews": "^2.5.0",
"@yoast/search-metadata-previews": "^2.6.0-rc.0",
"@yoast/style-guide": "^0.11.2",
"babel-polyfill": "^6.23.0",
"lodash": "4.17.11",
Expand All @@ -27,7 +27,7 @@
"redux-devtools-dock-monitor": "^1.1.3",
"redux-devtools-log-monitor": "^1.4.0",
"styled-components": "^4.3.2",
"yoastseo": "^1.76.0"
"yoastseo": "^1.77.0-rc.0"
},
"devDependencies": {
"@babel/preset-env": "^7.3.4",
Expand All @@ -49,7 +49,7 @@
"webpack": "4.19.1",
"webpack-cli": "^2.1.3",
"webpack-dev-server": "3.1.14",
"yoast-components": "^5.5.0"
"yoast-components": "^5.6.0-rc.0"
},
"peerDependencies": {
"material-ui": "^0.18.6",
Expand Down
8 changes: 4 additions & 4 deletions apps/content-analysis/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@yoast/content-analysis-app",
"version": "0.1.62",
"version": "0.1.63-rc.0",
"private": true,
"dependencies": {
"@babel/core": "7.7.4",
"@svgr/webpack": "4.3.3",
"@wordpress/i18n": "^3.1.1",
"@yoast/analysis-report": "^1.5.0",
"@yoast/components": "^2.3.0",
"@yoast/analysis-report": "^1.6.0-rc.0",
"@yoast/components": "^2.4.0-rc.0",
"@yoast/style-guide": "^0.11.2",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.3",
Expand Down Expand Up @@ -70,7 +70,7 @@
"webpack-manifest-plugin": "2.2.0",
"workbox-webpack-plugin": "4.3.1",
"worker-loader": "^2.0.0",
"yoastseo": "^1.76.0"
"yoastseo": "^1.77.0-rc.0"
},
"scripts": {
"start": "node scripts/start.js",
Expand Down
12 changes: 6 additions & 6 deletions apps/content-analysis/src/utils/getMorphologyData.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ function loadLocalMorphologyData() {
// eslint-disable-next-line global-require
data = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-v3.json" );
// eslint-disable-next-line global-require
dataDe = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-de-v7.json" );
dataDe = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-de-v8.json" );
// eslint-disable-next-line global-require
dataNL = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-nl-v7.json" );
dataNL = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-nl-v8.json" );
// eslint-disable-next-line global-require
dataES = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-es-v7.json" );
dataES = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-es-v8.json" );
// eslint-disable-next-line global-require
dataFR = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-fr-v7.json" );
dataFR = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-fr-v8.json" );
// eslint-disable-next-line global-require
dataRU = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-ru-v7.json" );
dataRU = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-ru-v8.json" );
// eslint-disable-next-line global-require
dataIT = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-it-v7.json" );
dataIT = require( "../../../../packages/yoastseo/premium-configuration/data/morphologyData-it-v8.json" );
} catch ( error ) {
// Falling back to empty data.
}
Expand Down
4 changes: 2 additions & 2 deletions packages/analysis-report/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoast/analysis-report",
"version": "1.5.0",
"version": "1.6.0-rc.0",
"main": "src/index.js",
"repository": {
"type": "git",
Expand All @@ -17,7 +17,7 @@
"private": false,
"dependencies": {
"@wordpress/i18n": "^1.1.0",
"@yoast/components": "^2.3.0",
"@yoast/components": "^2.4.0-rc.0",
"@yoast/helpers": "^0.12.1",
"@yoast/style-guide": "^0.11.2",
"lodash": "^4.17.11",
Expand Down
14 changes: 14 additions & 0 deletions packages/components/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file. Releases wi

We follow [Semantic Versioning](http://semver.org/).

## 2.4.0 June 22nd, 2020
### Enhancements
* Adds a new standardized Button class, which can render as a button or as an anchor tag.
* Adds a standardized Primary button and link.
* Adds a standardized Secondary button and link.
* Adds a standardized Upsell button and link.
* Adds a standardized Hide button and link.
* Adds a standardized Remove button and link.
* Adds a standardized Close button and link.
* Adds the HTML and CSS for the secondary, sales, hide and remove buttons.

### Other
* Adds documentation on how to add `@yoast/components` to your project.

## 2.3.0 June 8th, 2020
### Bugfixes
* Fixes a bug where the close button wasn't placed correctly in the metabox modals.
Expand Down
14 changes: 14 additions & 0 deletions packages/components/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
## Requirements
The Yoast/Components package is not pre-build. So if you would like to include `@yoast/components` into your project we will need a few steps to set it up.
### Loading Javascript.

1. Install the package by running `yarn add @yoast/components`.
2. Include Yoast/components into the babel-loader of your `webpack.config`. This will look something like this: `include: [ paths.appSrc, /node_modules[/\\](yoast-components|@yoast)[/\\].*/ ]`
3. It can be that you will need presets for the `babel-loader`. These are: `presets: [ "@babel/preset-env", "@babel/preset-react" ]`

Note that you will also need to install these presets. Run `yarn add --dev @babel/preset-env @babel/preset-react`

### Loading CSS

Because we are importing CSS in our JavaScript, your JavaScript bundler needs to be able to interpret CSS.

Therefore, you will need to use a css-loader in your bundler in order to use this package.

E.g. in Webpack: https://webpack.js.org/loaders/css-loader/

Make sure to add the CSS imports to your project. `import "@yoast/components/base";` This is a collection of all the CSS in `@yoast/components`.
It should be imported in App.js or index.js of your react project.

## Using the MultiSelect
The `MultiSelect` component requires the presence of both [jQuery](https://jquery.com/download/) and [Select2](https://select2.org/getting-started/installation). Make sure that they are available on the global window object before the component is instantiated.

Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoast/components",
"version": "2.3.0",
"version": "2.4.0-rc.0",
"description": "Yoast Components",
"main": "src/index.js",
"private": false,
Expand Down
68 changes: 68 additions & 0 deletions packages/components/src/button/Button.js
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;
32 changes: 32 additions & 0 deletions packages/components/src/button/Icon.js
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,
};
24 changes: 24 additions & 0 deletions packages/components/src/button/Primary.js
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,
};
Loading

0 comments on commit e688425

Please sign in to comment.