From 7a2efc30ef31a29550d6006ba1a850572ea03a8f Mon Sep 17 00:00:00 2001 From: Ivan Ottinger <25105483+ivan-ottinger@users.noreply.github.com> Date: Fri, 5 Nov 2021 16:40:31 +0100 Subject: [PATCH 1/2] Contact Info and Map widget: widget deprecation (#21554) * Add filter to deprecate the widget This commit hides the Contact info and Map widget from the block inserter and Legacy widget block drop-down menu. * Add the changelog file * Fix typo in the changelog file --- .../update-contact-info-and-map-widget-deprecate | 4 ++++ .../plugins/jetpack/modules/widgets/contact-info.php | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 projects/plugins/jetpack/changelog/update-contact-info-and-map-widget-deprecate diff --git a/projects/plugins/jetpack/changelog/update-contact-info-and-map-widget-deprecate b/projects/plugins/jetpack/changelog/update-contact-info-and-map-widget-deprecate new file mode 100644 index 0000000000000..1e61579ac038b --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-contact-info-and-map-widget-deprecate @@ -0,0 +1,4 @@ +Significance: minor +Type: compat + +Contact Info and Map widget: Hide widget from the block inserter and Legacy widget block drop-down menu diff --git a/projects/plugins/jetpack/modules/widgets/contact-info.php b/projects/plugins/jetpack/modules/widgets/contact-info.php index d98c0177bfa00..cfdb0e7fd3b5b 100644 --- a/projects/plugins/jetpack/modules/widgets/contact-info.php +++ b/projects/plugins/jetpack/modules/widgets/contact-info.php @@ -48,6 +48,18 @@ public function __construct() { } add_action( 'wp_ajax_customize-contact-info-api-key', array( $this, 'ajax_check_api_key' ) ); + add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hide_widget_in_block_editor' ) ); + } + + /** + * Remove "Contact info and Map" widget from Legacy Widget block. + * + * @param array $widget_types Widget type data. + * This only applies to new blocks being added. + */ + public function hide_widget_in_block_editor( $widget_types ) { + $widget_types[] = 'widget_contact_info'; + return $widget_types; } /** From 90d674363e8b005af302934a9045272a75f511e4 Mon Sep 17 00:00:00 2001 From: Filipe Varela Date: Fri, 5 Nov 2021 16:08:20 +0000 Subject: [PATCH 2/2] Storybook: add Jetpack Spinner (#21511) * Storybook: add Jetpack Spinner * Add changelog * Update according to Sergey's suggestions * Fixup project versions * remove unused argument * use color picker for color control * revert default color to white Co-authored-by: Foteini Giannaropoulou Co-authored-by: leogermani --- pnpm-lock.yaml | 18 +++++----- .../components/changelog/add-jetpack-spinner | 4 +++ .../components/components/spinner/README.md | 7 ++-- .../components/components/spinner/index.jsx | 19 ++++++++--- .../components/spinner/stories/index.jsx | 27 +++++++++++++++ .../components/spinner/test/component.jsx | 33 +++++++++++++++++++ projects/js-packages/components/package.json | 2 +- .../add-jetpack-spinner-to-storybook | 4 +++ projects/js-packages/connection/package.json | 4 +-- .../add-jetpack-spinner-to-storybook | 4 +++ projects/js-packages/idc/package.json | 2 +- .../add-jetpack-spinner-to-storybook | 4 +++ projects/js-packages/storybook/package.json | 4 +-- .../add-jetpack-spinner-to-storybook | 4 +++ projects/packages/connection-ui/package.json | 2 +- .../add-jetpack-spinner-to-storybook | 4 +++ projects/plugins/backup/package.json | 4 +-- .../add-jetpack-spinner-to-storybook | 4 +++ projects/plugins/jetpack/package.json | 4 +-- 19 files changed, 127 insertions(+), 27 deletions(-) create mode 100644 projects/js-packages/components/changelog/add-jetpack-spinner create mode 100644 projects/js-packages/components/components/spinner/stories/index.jsx create mode 100644 projects/js-packages/components/components/spinner/test/component.jsx create mode 100644 projects/js-packages/connection/changelog/add-jetpack-spinner-to-storybook create mode 100644 projects/js-packages/idc/changelog/add-jetpack-spinner-to-storybook create mode 100644 projects/js-packages/storybook/changelog/add-jetpack-spinner-to-storybook create mode 100644 projects/packages/connection-ui/changelog/add-jetpack-spinner-to-storybook create mode 100644 projects/plugins/backup/changelog/add-jetpack-spinner-to-storybook create mode 100644 projects/plugins/jetpack/changelog/add-jetpack-spinner-to-storybook diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 196de59e85443..8482d462f3ca2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -129,7 +129,7 @@ importers: projects/js-packages/connection: specifiers: '@automattic/jetpack-api': workspace:^0.5.0 - '@automattic/jetpack-components': workspace:^0.5.0 + '@automattic/jetpack-components': workspace:^0.6.0-alpha '@wordpress/base-styles': 4.0.2 '@wordpress/browserslist-config': 4.1.0 '@wordpress/components': 19.0.0 @@ -181,7 +181,7 @@ importers: projects/js-packages/idc: specifiers: '@automattic/jetpack-api': workspace:^0.5.0 - '@automattic/jetpack-components': workspace:^0.5.0 + '@automattic/jetpack-components': workspace:^0.6.0-alpha '@wordpress/base-styles': 4.0.2 '@wordpress/components': 19.0.0 '@wordpress/compose': 5.0.4 @@ -214,8 +214,8 @@ importers: projects/js-packages/storybook: specifiers: '@automattic/jetpack-base-styles': workspace:^0.1.0-alpha - '@automattic/jetpack-components': workspace:^0.5.0 - '@automattic/jetpack-connection': workspace:^0.9.0 + '@automattic/jetpack-components': workspace:^0.6.0-alpha + '@automattic/jetpack-connection': workspace:^0.9.1-alpha '@babel/core': 7.15.0 '@babel/plugin-syntax-jsx': 7.14.5 '@babel/runtime-corejs3': 7.15.3 @@ -340,7 +340,7 @@ importers: projects/packages/connection-ui: specifiers: '@automattic/jetpack-api': workspace:^0.5.0 - '@automattic/jetpack-connection': workspace:^0.9.0 + '@automattic/jetpack-connection': workspace:^0.9.1-alpha '@automattic/jetpack-idc': workspace:^0.4.2-alpha '@automattic/jetpack-webpack-config': workspace:^0.1.0-alpha '@babel/core': 7.15.0 @@ -440,8 +440,8 @@ importers: projects/plugins/backup: specifiers: '@automattic/jetpack-api': workspace:^0.5.0 - '@automattic/jetpack-components': workspace:^0.5.0 - '@automattic/jetpack-connection': workspace:^0.9.0 + '@automattic/jetpack-components': workspace:^0.6.0-alpha + '@automattic/jetpack-connection': workspace:^0.9.1-alpha '@automattic/jetpack-webpack-config': workspace:^0.1.0-alpha '@babel/core': 7.15.0 '@babel/preset-env': 7.15.0 @@ -572,8 +572,8 @@ importers: '@automattic/format-currency': 1.0.0-alpha.0 '@automattic/jetpack-analytics': workspace:^0.1.2 '@automattic/jetpack-api': workspace:^0.5.0 - '@automattic/jetpack-components': workspace:^0.5.0 - '@automattic/jetpack-connection': workspace:^0.9.0 + '@automattic/jetpack-components': workspace:^0.6.0-alpha + '@automattic/jetpack-connection': workspace:^0.9.1-alpha '@automattic/popup-monitor': 1.0.0 '@automattic/request-external-access': 1.0.0 '@automattic/social-previews': 1.1.1 diff --git a/projects/js-packages/components/changelog/add-jetpack-spinner b/projects/js-packages/components/changelog/add-jetpack-spinner new file mode 100644 index 0000000000000..196c61ce9ae2d --- /dev/null +++ b/projects/js-packages/components/changelog/add-jetpack-spinner @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Add Spinner in RNA components. diff --git a/projects/js-packages/components/components/spinner/README.md b/projects/js-packages/components/components/spinner/README.md index 4ee5a5b0c9a2b..3f6bb25301a98 100644 --- a/projects/js-packages/components/components/spinner/README.md +++ b/projects/js-packages/components/components/spinner/README.md @@ -19,6 +19,7 @@ export default class extends React.Component { The following props can be passed to the Spinner component: -| PROPERTY | TYPE | REQUIRED | DEFAULT | DESCRIPTION | -| -------- | -------- | -------- | ------- | ----------------------------------------------- | -| **size** | _number_ | no | `20` | The width and height of the spinner, in pixels. | +| PROPERTY | TYPE | REQUIRED | DEFAULT | DESCRIPTION | +| --------- | -------- | -------- | --------- | ----------------------------------------------- | +| **size** | _number_ | no | `20` | The width and height of the spinner, in pixels. | +| **color** | _strong_ | no | `#000000` | The color of the spinner, in hex. | diff --git a/projects/js-packages/components/components/spinner/index.jsx b/projects/js-packages/components/components/spinner/index.jsx index 5fda408843256..66531c94a183f 100644 --- a/projects/js-packages/components/components/spinner/index.jsx +++ b/projects/js-packages/components/components/spinner/index.jsx @@ -12,29 +12,40 @@ import './style.scss'; const Spinner = props => { const className = props.className + ' jp-components-spinner'; - const style = { + const styleOuter = { width: props.size, height: props.size, fontSize: props.size, // allows border-width to be specified in em units + borderTopColor: props.color, + }; + + const styleInner = { + borderTopColor: props.color, + borderRightColor: props.color, }; return (
-
-
+
+
); }; Spinner.propTypes = { + /** The spinner color. */ + color: PropTypes.string, + /** CSS class names. */ className: PropTypes.string, + /** The spinner size. */ size: PropTypes.number, }; Spinner.defaultProps = { - size: 20, + color: '#FFFFFF', className: '', + size: 20, }; export default Spinner; diff --git a/projects/js-packages/components/components/spinner/stories/index.jsx b/projects/js-packages/components/components/spinner/stories/index.jsx new file mode 100644 index 0000000000000..c8c0460e178a4 --- /dev/null +++ b/projects/js-packages/components/components/spinner/stories/index.jsx @@ -0,0 +1,27 @@ +/* eslint-disable react/react-in-jsx-scope */ +/** + * External dependencies + */ +import React from 'react'; + +/** + * Internal dependencies + */ +import Spinner from '../index.jsx'; + +export default { + title: 'Playground/Spinner', + component: Spinner, + argTypes: { + color: { control: 'color' }, + }, + parameters: { + backgrounds: { + default: 'dark', + }, + }, +}; + +const Template = args => ; + +export const _default = Template.bind( {} ); diff --git a/projects/js-packages/components/components/spinner/test/component.jsx b/projects/js-packages/components/components/spinner/test/component.jsx new file mode 100644 index 0000000000000..a9b9bc930d162 --- /dev/null +++ b/projects/js-packages/components/components/spinner/test/component.jsx @@ -0,0 +1,33 @@ +/** + * External dependencies + */ +import React from 'react'; +import { expect } from 'chai'; +import { shallow } from 'enzyme'; +import ShallowRenderer from 'react-test-renderer/shallow'; + +/** + * Internal dependencies + */ +import Spinner from '../index'; + +describe( 'Spinner', () => { + const testProps = { + className: 'sample-classname', + }; + + describe( 'Render the Spinner component', () => { + const renderer = new ShallowRenderer(); + renderer.render( ); + + const wrapper = shallow( renderer.getRenderOutput() ); + + it( 'component exists', () => { + expect( wrapper.find( 'Spinner' ) ).to.exist; + } ); + + it( 'validate the class name', () => { + expect( wrapper.hasClass( 'sample-classname' ) ).to.equal( true ); + } ); + } ); +} ); diff --git a/projects/js-packages/components/package.json b/projects/js-packages/components/package.json index 9a85b1ddbdd42..5ca09b7fa8949 100644 --- a/projects/js-packages/components/package.json +++ b/projects/js-packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-components", - "version": "0.5.0", + "version": "0.6.0-alpha", "description": "Jetpack Components Package", "author": "Automattic", "license": "GPL-2.0-or-later", diff --git a/projects/js-packages/connection/changelog/add-jetpack-spinner-to-storybook b/projects/js-packages/connection/changelog/add-jetpack-spinner-to-storybook new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/js-packages/connection/changelog/add-jetpack-spinner-to-storybook @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/js-packages/connection/package.json b/projects/js-packages/connection/package.json index df9e005c01d5c..8d0d6e1ab906d 100644 --- a/projects/js-packages/connection/package.json +++ b/projects/js-packages/connection/package.json @@ -1,12 +1,12 @@ { "name": "@automattic/jetpack-connection", - "version": "0.9.0", + "version": "0.9.1-alpha", "description": "Jetpack Connection Component", "author": "Automattic", "license": "GPL-2.0-or-later", "dependencies": { "@automattic/jetpack-api": "workspace:^0.5.0", - "@automattic/jetpack-components": "workspace:^0.5.0", + "@automattic/jetpack-components": "workspace:^0.6.0-alpha", "@wordpress/base-styles": "4.0.2", "@wordpress/browserslist-config": "4.1.0", "@wordpress/components": "19.0.0", diff --git a/projects/js-packages/idc/changelog/add-jetpack-spinner-to-storybook b/projects/js-packages/idc/changelog/add-jetpack-spinner-to-storybook new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/js-packages/idc/changelog/add-jetpack-spinner-to-storybook @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/js-packages/idc/package.json b/projects/js-packages/idc/package.json index 59dbb97c8847c..96f986467e4a7 100644 --- a/projects/js-packages/idc/package.json +++ b/projects/js-packages/idc/package.json @@ -6,7 +6,7 @@ "license": "GPL-2.0-or-later", "dependencies": { "@automattic/jetpack-api": "workspace:^0.5.0", - "@automattic/jetpack-components": "workspace:^0.5.0", + "@automattic/jetpack-components": "workspace:^0.6.0-alpha", "@wordpress/base-styles": "4.0.2", "@wordpress/components": "19.0.0", "@wordpress/compose": "5.0.4", diff --git a/projects/js-packages/storybook/changelog/add-jetpack-spinner-to-storybook b/projects/js-packages/storybook/changelog/add-jetpack-spinner-to-storybook new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/js-packages/storybook/changelog/add-jetpack-spinner-to-storybook @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/js-packages/storybook/package.json b/projects/js-packages/storybook/package.json index 130869cbcfcba..f79ab5e5ead7b 100644 --- a/projects/js-packages/storybook/package.json +++ b/projects/js-packages/storybook/package.json @@ -27,8 +27,8 @@ }, "devDependencies": { "@automattic/jetpack-base-styles": "workspace:^0.1.0-alpha", - "@automattic/jetpack-components": "workspace:^0.5.0", - "@automattic/jetpack-connection": "workspace:^0.9.0", + "@automattic/jetpack-components": "workspace:^0.6.0-alpha", + "@automattic/jetpack-connection": "workspace:^0.9.1-alpha", "@babel/core": "7.15.0", "@babel/plugin-syntax-jsx": "7.14.5", "@babel/runtime-corejs3": "7.15.3", diff --git a/projects/packages/connection-ui/changelog/add-jetpack-spinner-to-storybook b/projects/packages/connection-ui/changelog/add-jetpack-spinner-to-storybook new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/packages/connection-ui/changelog/add-jetpack-spinner-to-storybook @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/packages/connection-ui/package.json b/projects/packages/connection-ui/package.json index 2f575a077a9f5..2209b8505f844 100644 --- a/projects/packages/connection-ui/package.json +++ b/projects/packages/connection-ui/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@automattic/jetpack-api": "workspace:^0.5.0", - "@automattic/jetpack-connection": "workspace:^0.9.0", + "@automattic/jetpack-connection": "workspace:^0.9.1-alpha", "@automattic/jetpack-idc": "workspace:^0.4.2-alpha", "@wordpress/data": "6.1.2" }, diff --git a/projects/plugins/backup/changelog/add-jetpack-spinner-to-storybook b/projects/plugins/backup/changelog/add-jetpack-spinner-to-storybook new file mode 100644 index 0000000000000..c47cb18e82997 --- /dev/null +++ b/projects/plugins/backup/changelog/add-jetpack-spinner-to-storybook @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updated package dependencies. diff --git a/projects/plugins/backup/package.json b/projects/plugins/backup/package.json index 964f824d4dc25..be6ee6fa6722f 100644 --- a/projects/plugins/backup/package.json +++ b/projects/plugins/backup/package.json @@ -28,8 +28,8 @@ ], "dependencies": { "@automattic/jetpack-api": "workspace:^0.5.0", - "@automattic/jetpack-components": "workspace:^0.5.0", - "@automattic/jetpack-connection": "workspace:^0.9.0", + "@automattic/jetpack-components": "workspace:^0.6.0-alpha", + "@automattic/jetpack-connection": "workspace:^0.9.1-alpha", "@wordpress/api-fetch": "5.2.4", "@wordpress/data": "6.1.2", "@wordpress/date": "4.2.2", diff --git a/projects/plugins/jetpack/changelog/add-jetpack-spinner-to-storybook b/projects/plugins/jetpack/changelog/add-jetpack-spinner-to-storybook new file mode 100644 index 0000000000000..1eaea6a769e84 --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-jetpack-spinner-to-storybook @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Updated package dependencies. diff --git a/projects/plugins/jetpack/package.json b/projects/plugins/jetpack/package.json index 2dba9e8c4441d..18b4daacd73c4 100644 --- a/projects/plugins/jetpack/package.json +++ b/projects/plugins/jetpack/package.json @@ -65,8 +65,8 @@ "@automattic/format-currency": "1.0.0-alpha.0", "@automattic/jetpack-analytics": "workspace:^0.1.2", "@automattic/jetpack-api": "workspace:^0.5.0", - "@automattic/jetpack-components": "workspace:^0.5.0", - "@automattic/jetpack-connection": "workspace:^0.9.0", + "@automattic/jetpack-components": "workspace:^0.6.0-alpha", + "@automattic/jetpack-connection": "workspace:^0.9.1-alpha", "@automattic/popup-monitor": "1.0.0", "@automattic/request-external-access": "1.0.0", "@automattic/social-previews": "1.1.1",