-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publicize: Add new publicize icon toggle component (#20957)
- Add new ConnectionToggle component that includes service profile picture, username, icon, and toggle. - Add new ConnectionIcon component that includes service profile picture, username, and icon. - Update Facebook and Twitter social icons to fulfill brand guidelines. This will also change the icons in the Social Previews panel and modal. - Update Publicize module and endpoint schemas to include profile_picture - Refresh Publicize connections and set a transient to stagger requests
- Loading branch information
1 parent
ce8cdf0
commit d560a45
Showing
13 changed files
with
305 additions
and
61 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
4 changes: 4 additions & 0 deletions
4
projects/plugins/jetpack/changelog/add-re-publicize-icon-component
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,4 @@ | ||
Significance: minor | ||
Type: enhancement | ||
|
||
Add the user's profile picture and new styling to the Publicize toggle. |
40 changes: 40 additions & 0 deletions
40
projects/plugins/jetpack/extensions/plugins/publicize/components/connection-icon/index.jsx
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,40 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { SocialServiceIcon } from '../../../../shared/icons'; | ||
|
||
/** | ||
* Style dependencies | ||
*/ | ||
import './style.scss'; | ||
|
||
const ConnectionIcon = props => { | ||
const { id, serviceName, label, profilePicture } = props; | ||
|
||
return ( | ||
<label htmlFor={ id } className="jetpack-publicize-connection-label"> | ||
<div className={ profilePicture ? 'components-connection-icon__picture' : '' }> | ||
{ profilePicture && <img src={ profilePicture } alt={ label } /> } | ||
<SocialServiceIcon | ||
serviceName={ serviceName } | ||
className="jetpack-publicize-gutenberg-social-icon" | ||
/> | ||
</div> | ||
<span className="jetpack-publicize-connection-label-copy">{ label }</span> | ||
</label> | ||
); | ||
}; | ||
|
||
ConnectionIcon.propTypes = { | ||
id: PropTypes.string.isRequired, | ||
serviceName: PropTypes.string, | ||
label: PropTypes.string, | ||
profilePicture: PropTypes.string, | ||
}; | ||
|
||
export default ConnectionIcon; |
36 changes: 36 additions & 0 deletions
36
projects/plugins/jetpack/extensions/plugins/publicize/components/connection-icon/style.scss
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,36 @@ | ||
.jetpack-publicize-connection-label { | ||
display: flex; | ||
align-items: center; | ||
|
||
// Icon and picture. | ||
.components-connection-icon__picture { | ||
display: grid; | ||
|
||
img, | ||
.placeholder { | ||
border-radius: 2px; | ||
width: 24px; | ||
height: 24px; | ||
grid-area: 1 / 1 / 2 / 2; | ||
} | ||
|
||
.placeholder { | ||
display: block; | ||
background-color: #a8bece; | ||
} | ||
|
||
svg { | ||
width: 15px; | ||
height: 15px; | ||
grid-area: 1 / 1 / 2 / 2; | ||
margin-top: 14px; | ||
margin-left: 14px; | ||
border-radius: 2px; | ||
background-color: white; | ||
|
||
&.is-facebook { | ||
border-radius: 50%; | ||
} | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
projects/plugins/jetpack/extensions/plugins/publicize/components/connection-toggle/index.jsx
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,60 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import classnames from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { FormToggle } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import ConnectionIcon from '../connection-icon'; | ||
|
||
/** | ||
* Style dependencies | ||
*/ | ||
import './style.scss'; | ||
|
||
const ConnectionToggle = props => { | ||
const { className, checked, id, disabled, onChange, serviceName, label, profilePicture } = props; | ||
|
||
const wrapperClasses = classnames( 'components-connection-toggle', { | ||
'is-not-checked': ! checked, | ||
'is-disabled': disabled, | ||
} ); | ||
|
||
return ( | ||
<div className={ wrapperClasses }> | ||
<ConnectionIcon | ||
id={ id } | ||
serviceName={ serviceName } | ||
label={ label } | ||
profilePicture={ profilePicture } | ||
/> | ||
<FormToggle | ||
id={ id } | ||
className={ className } | ||
checked={ checked } | ||
onChange={ onChange } | ||
disabled={ disabled } | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
ConnectionToggle.propTypes = { | ||
className: PropTypes.string, | ||
checked: PropTypes.bool, | ||
id: PropTypes.string.isRequired, | ||
disabled: PropTypes.bool, | ||
onChange: PropTypes.func, | ||
serviceName: PropTypes.string, | ||
label: PropTypes.string, | ||
profilePicture: PropTypes.string, | ||
}; | ||
|
||
export default ConnectionToggle; |
19 changes: 19 additions & 0 deletions
19
...ects/plugins/jetpack/extensions/plugins/publicize/components/connection-toggle/style.scss
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,19 @@ | ||
@import '../../../../shared/styles/gutenberg-base-styles.scss'; | ||
|
||
.components-connection-toggle { | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
width: 100%; | ||
|
||
// Unchecked state. | ||
&.is-not-checked .jetpack-gutenberg-social-icon { | ||
fill: $gray-300; | ||
} | ||
|
||
// Disabled state: | ||
&.is-disabled, | ||
.components-disabled & { | ||
opacity: 0.5; | ||
} | ||
} |
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
Oops, something went wrong.