Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetpack: Extend disconnection dialog component to handle multiple steps and accept more props #21048

Merged
merged 100 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
7ed751f
Add initial structure to the disconnection dialog component to handle…
jboland88 Sep 9, 2021
7c1b3c9
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Sep 30, 2021
f28233c
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Oct 8, 2021
364609f
Update disconnect step with output for connected plugins, add compone…
jboland88 Oct 8, 2021
ec669fe
Add content and styling to disconnect flow, intial handling for survey
jboland88 Oct 14, 2021
5eb49f8
Updated condition for when no connectedPlugins are provided, small st…
jboland88 Oct 14, 2021
bfc591b
Break out smaller components, add initialization for tracks
jboland88 Oct 20, 2021
0c806cd
[not verified] Merge branch 'master' into update/extend-disconnect-di…
jboland88 Oct 20, 2021
e149231
Update lock file after merging master
jboland88 Oct 20, 2021
dec8af5
Fix filtering for connected plugins output, update comments
jboland88 Oct 20, 2021
4fa0743
Design improvements, move control for opening DisconnectDialog outsid…
jboland88 Oct 22, 2021
82bcf52
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Oct 22, 2021
a03f011
Update styles to use color variables, update JS unit tests
jboland88 Oct 25, 2021
2355dd7
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Oct 25, 2021
d247f85
Update projects/js-packages/connection/components/disconnect-dialog/i…
jboland88 Oct 27, 2021
b75eecf
Update projects/js-packages/connection/components/disconnect-dialog/s…
jboland88 Oct 27, 2021
f76ae91
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Oct 27, 2021
4eafc91
Refactor CSS and documentation, small updates and fixes
jboland88 Oct 27, 2021
d2792bf
Add changelog file for decorative card in components package
jboland88 Oct 27, 2021
774e1ec
Update JS props docs for ConnectionStatusCard
jboland88 Oct 27, 2021
18ad8a0
Bump versions of connection and components packages
jboland88 Oct 27, 2021
1990164
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Oct 27, 2021
c198681
Cascading version bump
jboland88 Oct 27, 2021
73a1594
Small style fix for buttons in disconnectdialog component
jboland88 Nov 1, 2021
d6a8b9d
[not verified] Merge branch 'master' into update/extend-disconnect-di…
jboland88 Nov 8, 2021
4766686
Improve mobile styling for disconnect modal
jboland88 Nov 8, 2021
87b4d2f
Package version bump
jboland88 Nov 8, 2021
1b0a985
Remove the assetBaseUrl prop for images, this is handled via the webp…
jboland88 Nov 8, 2021
7b5b298
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Nov 9, 2021
f641496
Update to use jetpack-config package to get the current plugin slug
jboland88 Nov 9, 2021
1072b1f
Remove currentPlugin from propTypes of ConnectionStatusCard
jboland88 Nov 9, 2021
8a79b8e
[not verified] Merge branch 'master' into update/extend-disconnect-di…
jboland88 Nov 9, 2021
b85d691
Move logic to load the consumer_slug from the jetpackConfig to the Di…
jboland88 Nov 9, 2021
4400a77
Update projects/js-packages/connection/components/disconnect-card/ind…
jboland88 Nov 9, 2021
f15b958
Fix propTypes and add story (#21680)
leogermani Nov 9, 2021
3282495
Update survey submission method
jboland88 Nov 15, 2021
72469f6
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Nov 15, 2021
fab9496
Disable the submit button when waiting on response from survey submis…
jboland88 Nov 15, 2021
9a81ee9
Add context prop to ConnectCard component and improve analytics events
jboland88 Nov 16, 2021
be83146
Package version bump
jboland88 Nov 16, 2021
00cdcf4
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Nov 16, 2021
07ce3ca
Version bump for components in licensing package
jboland88 Nov 16, 2021
54be5b3
[not verified] Un-prettify JS file that does not need to be a part of…
jboland88 Nov 16, 2021
a5dda53
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Nov 16, 2021
b509857
Small adjustment in pnpm-lock file after pnpm-install
jboland88 Nov 16, 2021
76d1a13
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Nov 18, 2021
a2a527a
Update promise handling for survey submission and other feedback points
jboland88 Nov 18, 2021
f46b50e
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Nov 18, 2021
0fe5b83
Upodate references to rna styles in scss to use base styles package
jboland88 Nov 18, 2021
8201388
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Nov 18, 2021
795b7ce
Use maxlength instead of max on custom survey response input
jboland88 Nov 18, 2021
307c377
Remove unused assetBase prop from ConnectionStatusCard component
jboland88 Nov 18, 2021
2d6dd74
[not verified] Merge branch 'master' into update/extend-disconnect-di…
jboland88 Nov 20, 2021
e6d0ee1
Pass connectedSiteId as a prop to the ConnectionStatusCard component
jboland88 Nov 20, 2021
5b7ef85
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Nov 23, 2021
b870ef9
Fix package versions
jboland88 Nov 23, 2021
9fd7b43
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Nov 23, 2021
8d44230
[not verified] Add initial structure to the disconnection dialog comp…
jboland88 Sep 9, 2021
9c2b973
[not verified] Update disconnect step with output for connected plugi…
jboland88 Oct 8, 2021
a543f13
Add content and styling to disconnect flow, intial handling for survey
jboland88 Oct 14, 2021
93ee942
[not verified] Updated condition for when no connectedPlugins are pro…
jboland88 Oct 14, 2021
226c90c
[not verified] Break out smaller components, add initialization for t…
jboland88 Oct 20, 2021
6c2971f
Update lock file after merging master
jboland88 Oct 20, 2021
397f93c
[not verified] Fix filtering for connected plugins output, update com…
jboland88 Oct 20, 2021
859c746
Design improvements, move control for opening DisconnectDialog outsid…
jboland88 Oct 22, 2021
23dd494
Update styles to use color variables, update JS unit tests
jboland88 Oct 25, 2021
0e485d2
[not verified] Update projects/js-packages/connection/components/disc…
jboland88 Oct 27, 2021
e220cb2
[not verified] Update projects/js-packages/connection/components/disc…
jboland88 Oct 27, 2021
d9f625e
[not verified] Refactor CSS and documentation, small updates and fixes
jboland88 Oct 27, 2021
0eddff7
[not verified] Add changelog file for decorative card in components p…
jboland88 Oct 27, 2021
81c6755
[not verified] Update JS props docs for ConnectionStatusCard
jboland88 Oct 27, 2021
3af5ec5
Cascading version bump
jboland88 Oct 27, 2021
a8d0c17
[not verified] Small style fix for buttons in disconnectdialog component
jboland88 Nov 1, 2021
639d288
[not verified] Improve mobile styling for disconnect modal
jboland88 Nov 8, 2021
7835071
Package version bump
jboland88 Nov 8, 2021
47fe08b
[not verified] Remove the assetBaseUrl prop for images, this is handl…
jboland88 Nov 8, 2021
ab43828
Update to use jetpack-config package to get the current plugin slug
jboland88 Nov 9, 2021
609e547
[not verified] Remove currentPlugin from propTypes of ConnectionStatu…
jboland88 Nov 9, 2021
2dd9269
Move logic to load the consumer_slug from the jetpackConfig to the Di…
jboland88 Nov 9, 2021
930279d
[not verified] Update projects/js-packages/connection/components/disc…
jboland88 Nov 9, 2021
99326c8
[not verified] Fix propTypes and add story (#21680)
leogermani Nov 9, 2021
1355b11
[not verified] Update survey submission method
jboland88 Nov 15, 2021
7a416cf
[not verified] Disable the submit button when waiting on response fro…
jboland88 Nov 15, 2021
d343f90
[not verified] Add context prop to ConnectCard component and improve …
jboland88 Nov 16, 2021
5f50108
Package version bump
jboland88 Nov 16, 2021
46307c6
Version bump for components in licensing package
jboland88 Nov 16, 2021
ef12e9b
[not verified] Un-prettify JS file that does not need to be a part of…
jboland88 Nov 16, 2021
165ec1d
[not verified] Update promise handling for survey submission and othe…
jboland88 Nov 18, 2021
c694f11
[not verified] Upodate references to rna styles in scss to use base s…
jboland88 Nov 18, 2021
d027100
[not verified] Use maxlength instead of max on custom survey response…
jboland88 Nov 18, 2021
d952012
[not verified] Remove unused assetBase prop from ConnectionStatusCard…
jboland88 Nov 18, 2021
3d6d60a
[not verified] Pass connectedSiteId as a prop to the ConnectionStatus…
jboland88 Nov 20, 2021
f0bd158
Fix package versions
jboland88 Nov 23, 2021
b58d643
[not verified] Jetpack: improve plugin disconnection flow (#20914)
jboland88 Nov 25, 2021
c1437e7
Fix package versions
IanRamosC Nov 26, 2021
afac99c
Merge remote-tracking branch 'origin/master' into update/extend-disco…
IanRamosC Nov 29, 2021
a35ffef
Merge branch 'update/extend-disconnect-dialog-component' of github.co…
jboland88 Nov 29, 2021
eeb3036
Merge branch 'master' into update/extend-disconnect-dialog-component
jboland88 Nov 29, 2021
aa1bac9
Version bump for partner coupon package
jboland88 Nov 29, 2021
5f86825
Update projects/plugins/jetpack/class.jetpack.php
jboland88 Nov 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
759 changes: 735 additions & 24 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package version
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Add a new DecorativeCard component to the components package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* External Dependencies
*/
import React from 'react';
import PropTypes from 'prop-types';

/**
* Internal Dependencies
*/
import './style.scss';

/**
* A decorative card used in the disconnection flow.
*
* @param {object} props - The properties.
* @returns {React.Component} - The DecorativeCard component.
*/

const DecorativeCard = props => {
const { format, icon, imageUrl } = props;

const renderIcon = () => {
if ( icon ) {
return (
<div className="jp-components__decorative-card__icon-container">
<span
className={
'jp-components__decorative-card__icon jp-components__decorative-card__icon--' + icon
}
></span>
</div>
);
}
};

return (
<div
className={
'jp-components__decorative-card ' +
( format ? 'jp-components__decorative-card--' + format : '' )
}
>
<div
className="jp-components__decorative-card__image"
style={ { backgroundImage: imageUrl ? `url( ${ imageUrl } )` : '' } }
></div>
<div className="jp-components__decorative-card__content">
<div className="jp-components__decorative-card__lines"></div>
</div>
{ renderIcon() }
</div>
);
};

DecorativeCard.propTypes = {
/** The format of the card (horizontal or vertical) */
format: PropTypes.oneOf( [ 'horizontal', 'vertical' ] ),
/** An icon slug that can be used to show an icon (options are limited to what is in the stylesheet) */
icon: PropTypes.oneOf( [ 'unlink' ] ),
/** URL for an image to show in the card. */
imageUrl: PropTypes.string,
};

DecorativeCard.defaultProps = {
format: 'horizontal',
};

export default DecorativeCard;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* External dependencies
*/
import React from 'react';
import DecorativeCard from '../index.jsx';

export default {
title: 'Playground/Decorative Card',
component: DecorativeCard,
};

// Export additional stories using pre-defined values
const Template = args => <DecorativeCard { ...args } />;

// Export Default story
export const _default = Template.bind( {} );

export const Unlink = Template.bind( {} );
Unlink.args = {
icon: 'unlink',
};
116 changes: 116 additions & 0 deletions projects/js-packages/components/components/decorative-card/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
@import '~@automattic/jetpack-base-styles/style';

.jp-components__decorative-card {
display: flex;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 0 15px var( --jp-gray );
position: relative;
width: 360px;
max-width: 100%;
height: 280px;
margin: 0 auto;
margin-bottom: 3rem;

&__image,
&__content {
width: 50%;
}

&__image {
background: var( --jp-gray );
background-size: cover;
position: relative;

&:before {
content: '';
display: block;
position: absolute;
top: 24px;
left: 24px;
width: 38px;
height: 8px;
background-image: url('data:image/svg+xml;uf8,<svg width="38" height="8" viewBox="0 0 38 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 7C1 7 2.37087 1 6.89831 1C11.4257 1 14.3709 7 18.8983 7C23.4257 7 26.7777 1 31.3051 1C35.912 1 37 7 37 7" stroke="white" stroke-width="1.5" stroke-linejoin="round"/></svg>');
}
}

&__content {
background: #FFFFFF;
padding: 2rem;
}

&__icon-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80px;
height: 80px;
background: var(--jp-red);
border-radius: 50px;
}

&__icon {
width: 40px;
height: 40px;
position: absolute;
top: 50%;
left: 50%;
transform: translate( -50%, -50% );
background-position: center, center;
background-repeat: no-repeat;

&--unlink {
background-image: url('data:image/svg+xml;uf8,<svg width="34" height="37" viewBox="0 0 34 37" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M22.3335 10.001H25.0002C29.4184 10.001 33.0002 13.5827 33.0002 18.001V19.7788C33.0002 24.197 29.4184 27.7788 25.0002 27.7788H22.3335" stroke="white" stroke-width="1.5" stroke-linecap="square"/> <path d="M11.6675 27.7783L9.00082 27.7783C4.58254 27.7783 1.00081 24.1966 1.00081 19.7783L1.00081 18.0005C1.00081 13.5823 4.58253 10.0005 9.00081 10.0005L11.6675 10.0005" stroke="white" stroke-width="1.5" stroke-linecap="square"/> <path d="M10.9998 19.167L16.9998 19.167" stroke="white" stroke-width="1.5"/> <path d="M8.99951 35.998L24.9995 0.998048" stroke="white"/> </svg>')
}
}

&__lines {
display: block;
width: 100%;
height: 12px;
border-radius: 6px;
background: #E9EFF5;
position: relative;

&::before,
&::after {
content: '';
display: block;
width: 100%;
height: 12px;
border-radius: 6px;
background: #E9EFF5;
position: relative;
top: calc(100% + 16px);
}

&:after {
top: calc(100% + 32px);
width: 75%;
}
}

// Variants
&--vertical {
flex-direction: column;

.jp-components__decorative-card__image,
.jp-components__decorative-card__content {
width: 100%;
height: 50%;
}

.jp-components__decorative-card__lines {
max-width: 135px;
margin-left: auto;
margin-right: auto;

&::before,
&::after {
margin-left: auto;
margin-right: auto;
}
}
}
}
1 change: 1 addition & 0 deletions projects/js-packages/components/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ export { default as JetpackFooter } from './components/jetpack-footer';
export { default as Spinner } from './components/spinner';
export { default as ActionButton } from './components/action-button';
export { default as PricingCard } from './components/pricing-card';
export { default as DecorativeCard } from './components/decorative-card';
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.6.4-alpha",
"version": "0.7.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: minor
Type: changed

Extend functionality of the disconnect modal to allow it to be used in more contexts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* External Dependencies
*/
import React, { useMemo } from 'react';
import PropTypes from 'prop-types';
import { __ } from '@wordpress/i18n';

/**
* Internal Dependencies
*/
import DisconnectCard from '../disconnect-card';

/**
* Render a list of connected plugins.
*
* @param {object} props - The properties
* @returns {React.Component} - The ConnectedPlugins React component
*/

const ConnectedPlugins = props => {
const { connectedPlugins, disconnectingPlugin } = props;

/**
* Add a slug property to each ConnectedPlugins object so they can be converted to an array.
* This allows the connected plugins to be iterated over more easily for display.
*/
const connectedPluginsArray = useMemo( () => {
if ( connectedPlugins ) {
const keys = Object.keys( connectedPlugins );
return keys
.map( key => {
return Object.assign( { slug: key }, connectedPlugins[ key ] );
} )
.filter( plugin => {
return disconnectingPlugin !== plugin.slug;
} );
}

// No connected plugins.
return [];
}, [ connectedPlugins, disconnectingPlugin ] );

if ( connectedPlugins && connectedPluginsArray.length > 0 ) {
return (
<React.Fragment>
<div className="jp-connection__disconnect-dialog__step-copy">
<p className="jp-connection__disconnect-dialog__large-text">
{ __(
'Jetpack is powering other plugins on your site. If you disconnect, these plugins will no longer work.',
'jetpack'
) }
</p>
</div>
<div className="jp-connection__disconnect-card__group">
{ connectedPluginsArray.map( plugin => {
return <DisconnectCard title={ plugin.name } />;
} ) }
</div>
</React.Fragment>
);
}

// Default to null if there are no connected plugins passed on the props
return null;
};

ConnectedPlugins.PropTypes = {
/** Plugins that are using the Jetpack connection. */
connectedPlugins: PropTypes.object,
/** Slug of the plugin that has initiated the disconnect. */
disconnectingPlugin: PropTypes.string,
};

export default ConnectedPlugins;
Loading