Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into add/use-webpack-con…
Browse files Browse the repository at this point in the history
…fig-js-package-in-jetpack
  • Loading branch information
anomiex committed Nov 5, 2021
2 parents 19011dc + 90d6743 commit a7d423c
Show file tree
Hide file tree
Showing 21 changed files with 145 additions and 30 deletions.
23 changes: 11 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions projects/js-packages/components/changelog/add-jetpack-spinner
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Add Spinner in RNA components.
7 changes: 4 additions & 3 deletions projects/js-packages/components/components/spinner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
19 changes: 15 additions & 4 deletions projects/js-packages/components/components/spinner/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className={ className }>
<div className="jp-components-spinner__outer" style={ style }>
<div className="jp-components-spinner__inner" />
<div className="jp-components-spinner__outer" style={ styleOuter }>
<div className="jp-components-spinner__inner" style={ styleInner } />
</div>
</div>
);
};

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;
Original file line number Diff line number Diff line change
@@ -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 => <Spinner { ...args } />;

export const _default = Template.bind( {} );
Original file line number Diff line number Diff line change
@@ -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( <Spinner { ...testProps } /> );

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 );
} );
} );
} );
2 changes: 1 addition & 1 deletion projects/js-packages/components/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
4 changes: 2 additions & 2 deletions projects/js-packages/connection/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
2 changes: 1 addition & 1 deletion projects/js-packages/idc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
4 changes: 2 additions & 2 deletions projects/js-packages/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
2 changes: 1 addition & 1 deletion projects/packages/connection-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
4 changes: 2 additions & 2 deletions projects/plugins/backup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Updated package dependencies.
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions projects/plugins/jetpack/modules/widgets/contact-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions projects/plugins/jetpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,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",
Expand Down

0 comments on commit a7d423c

Please sign in to comment.