diff --git a/assets/components/src/button-card/index.js b/assets/components/src/button-card/index.js new file mode 100644 index 0000000000..4e5b5480cd --- /dev/null +++ b/assets/components/src/button-card/index.js @@ -0,0 +1,49 @@ +/** + * Button Card + */ + +/** + * WordPress dependencies + */ +import { Component } from '@wordpress/element'; +import { Icon, chevronRight } from '@wordpress/icons'; + +/** + * Internal dependencies + */ +import './style.scss'; + +/** + * External dependencies + */ +import classnames from 'classnames'; + +class ButtonCard extends Component { + /** + * Render + */ + render() { + const { chevron, className, desc, grouped, icon, isSmall, title, ...otherProps } = this.props; + const classes = classnames( + 'newspack-button-card', + className, + chevron && 'has-chevron', + grouped && 'grouped', + icon && 'has-icon', + isSmall && 'is-small' + ); + + return ( + + { icon && } + + { title && { title } } + { desc && { desc } } + + { chevron && } + + ); + } +} + +export default ButtonCard; diff --git a/assets/components/src/button-card/style.scss b/assets/components/src/button-card/style.scss new file mode 100644 index 0000000000..8d00e8c490 --- /dev/null +++ b/assets/components/src/button-card/style.scss @@ -0,0 +1,140 @@ +/** + * Button Card + */ + +@import '../../../shared/scss/colors'; +@import '~@wordpress/base-styles/colors'; + +.newspack-button-card { + border-radius: 3px; + border: 1px solid $light-gray-500; + box-shadow: inset 0 0 0 2px transparent; + cursor: pointer; + display: block; + margin: 32px 0; + padding: 32px; + text-decoration: none; + transition: background-color 125ms ease-in-out, border-color 125ms ease-in-out, + box-shadow 125ms ease-in-out; + + &:active, + &:focus, + &:hover { + background-color: $light-gray-100; + color: $primary-600; + text-decoration: none; + + .title, + .desc { + color: inherit; + } + } + + &:focus { + border-color: $primary-500; + box-shadow: inset 0 0 0 2px $primary-500 !important; + outline: none !important; + position: relative; + } + + .title, + .desc { + line-height: 24px; + transition: color 125ms ease-in-out; + } + + .title { + color: $dark-gray-900; + font-size: 17px; + font-weight: bold; + } + + .desc { + color: $dark-gray-300; + font-size: 14px; + } + + // Grouped + + &.grouped { + border-radius: 0; + + & + &:not( .br--top ) { + margin-top: -33px; + } + + &.br--bottom { + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + } + + &.br--top { + border-top-left-radius: 3px; + border-top-right-radius: 3px; + } + } + + // Chevron & Icon + + &.has-chevron, + &.has-icon { + align-items: center; + display: grid; + grid-gap: 16px; + grid-template-columns: auto 24px; + + &:active, + &:focus, + &:hover { + svg { + fill: currentColor; + } + } + + svg { + fill: $primary-500; + transition: fill 125ms ease-in-out; + } + } + + &.has-icon { + grid-template-columns: 48px auto; + + &.has-chevron { + grid-template-columns: 48px auto 24px; + } + } + + // Is Small + + &.is-small { + padding: 16px; + + &.has-chevron, + &.has-icon { + grid-gap: 8px; + + svg { + height: 24px; + width: 24px; + } + } + + &.has-icon { + grid-template-columns: 24px auto; + + &.has-chevron { + grid-template-columns: 24px auto 24px; + } + } + + .title { + font-size: 14px; + } + + .desc { + font-size: 12px; + line-height: 16px; + } + } +} diff --git a/assets/components/src/card/style.scss b/assets/components/src/card/style.scss index 73311ae1fa..58c829299e 100644 --- a/assets/components/src/card/style.scss +++ b/assets/components/src/card/style.scss @@ -41,18 +41,6 @@ } } - // Is Clickable - - &--is-clickable { - cursor: pointer; - transition: box-shadow 150ms ease-in-out, transform 150ms ease-in-out; - - &:hover { - box-shadow: 0 8px 16px rgba( black, 0.08 ); - transform: translateY( -4px ); - } - } - // Is Small &__is-small { diff --git a/assets/components/src/index.js b/assets/components/src/index.js index 0aecf0cb41..ad5eddc9b8 100644 --- a/assets/components/src/index.js +++ b/assets/components/src/index.js @@ -1,7 +1,8 @@ export { default as ActionCard } from './action-card'; export { default as AutocompleteTokenField } from './autocomplete-tokenfield'; -export { default as Button } from './button'; export { default as AutocompleteWithSuggestions } from './autocomplete-with-suggestions'; +export { default as Button } from './button'; +export { default as ButtonCard } from './button-card'; export { default as ButtonGroup } from './button-group'; export { default as Card } from './card'; export { default as PreviewBox } from './preview-box'; diff --git a/assets/wizards/componentsDemo/index.js b/assets/wizards/componentsDemo/index.js index 67e8047b90..a32592aff3 100644 --- a/assets/wizards/componentsDemo/index.js +++ b/assets/wizards/componentsDemo/index.js @@ -14,6 +14,7 @@ import apiFetch from '@wordpress/api-fetch'; import { decodeEntities } from '@wordpress/html-entities'; import { addQueryArgs } from '@wordpress/url'; import { __ } from '@wordpress/i18n'; +import { audio, plus, reusableBlock, typography } from '@wordpress/icons'; /** * Internal dependencies. @@ -25,6 +26,7 @@ import { CheckboxControl, Card, Button, + ButtonCard, Handoff, Notice, Footer, @@ -522,6 +524,51 @@ class ComponentsDemo extends Component { + + { __( 'ButtonCard' ) } + + + + + + diff --git a/assets/wizards/dashboard/index.js b/assets/wizards/dashboard/index.js index 78078947b0..02a3eb980e 100644 --- a/assets/wizards/dashboard/index.js +++ b/assets/wizards/dashboard/index.js @@ -20,7 +20,7 @@ import { Icon, plugins } from '@wordpress/icons'; */ import { GlobalNotices, - Button, + ButtonCard, Card, Waiting, Footer, @@ -30,11 +30,6 @@ import { import DashboardCard from './views/dashboardCard'; import './style.scss'; -/** - * External dependencies. - */ -import classnames from 'classnames'; - const Dashboard = ( { items } ) => { const params = qs.parse( window.location.search ); const authCode = params.code; @@ -106,30 +101,28 @@ const Dashboard = ( { items } ) => { ) } { displayAuth ? ( - + <> { userBasicInfo ? ( - - - + + + { __( 'Google OAuth2' ) } { __( 'Authorized Google as', 'newspack' ) }{' '} { userBasicInfo.email } - + ) : ( - - - - - { __( 'Google OAuth2' ) } - { __( 'Authorize Newspack with Google', 'newspack' ) } - - - + ) } - + > ) : null } diff --git a/assets/wizards/dashboard/style.scss b/assets/wizards/dashboard/style.scss index 962038830b..eb4d46a8da 100644 --- a/assets/wizards/dashboard/style.scss +++ b/assets/wizards/dashboard/style.scss @@ -6,84 +6,21 @@ @import '../../shared/scss/colors'; .newspack-dashboard-card { + align-items: center; border-color: $light-gray-500; + display: grid; + grid-gap: 16px; + grid-template-columns: 48px auto; margin: 0; - padding: 0; - - &.disabled { - > * { - opacity: 0.75; - } - } - - a, - body[class*='admin-color-'] & .newspack-button { - align-items: center; - border-radius: inherit; - color: inherit; - display: flex; - font-weight: inherit; - height: 100%; - justify-content: space-between; - padding: 0; - text-align: inherit; - text-decoration: none; - transition: background-color 125ms ease-in-out, box-shadow 125ms ease-in-out; - - &:active, - &:focus, - &:hover { - background-color: $light-gray-100; - box-shadow: 0 4px 8px rgba( black, 0.08 ); - color: $primary-600; - - h2 { - color: inherit; - } - - svg { - fill: currentColor; - } - } - - &:focus { - outline: none; - } - } + padding: 32px; h2, p { margin: 0; - transition: color 125ms ease-in-out; } svg { - display: block; - flex-shrink: 0; fill: $primary-500; - height: 48px; - margin: 0 8px 0 0; - transition: fill 125ms ease-in-out; - width: 48px; - - &.icon-completed { - fill: $alert-green; - } - } - - &__contents { - align-items: center; - display: flex; - justify-content: flex-start; - padding: 32px; - - @media screen and ( min-width: 744px ) { - min-height: 136px; - } - - .newspack-dashboard-card__header { - margin-left: 8px; - } } } diff --git a/assets/wizards/dashboard/views/dashboardCard.js b/assets/wizards/dashboard/views/dashboardCard.js index b8c9135f75..f6625acc96 100644 --- a/assets/wizards/dashboard/views/dashboardCard.js +++ b/assets/wizards/dashboard/views/dashboardCard.js @@ -7,7 +7,6 @@ */ import { Component } from '@wordpress/element'; import { - Icon, chartLine, help, lifesaver, @@ -15,7 +14,6 @@ import { payment, postComments, plugins, - reusableBlock, rss, search, stretchWide, @@ -25,12 +23,7 @@ import { /** * Internal dependencies. */ -import { Card } from '../../../components/src'; - -/** - * External dependencies. - */ -import classNames from 'classnames'; +import { ButtonCard } from '../../../components/src'; class DashboardCard extends Component { /** @@ -38,34 +31,25 @@ class DashboardCard extends Component { */ render() { const { name, description, slug, url } = this.props; - const classes = classNames( 'newspack-dashboard-card', slug ); const iconMap = { - 'site-design': , - 'reader-revenue': , - advertising: , - syndication: , - analytics: , - seo: , - 'health-check': , - engagement: , - popups: , - support: , - updates: , + 'site-design': typography, + 'reader-revenue': payment, + advertising: stretchWide, + syndication: rss, + analytics: chartLine, + seo: search, + 'health-check': lifesaver, + engagement: postComments, + popups: megaphone, + support: help, }; - const contents = ( - - { iconMap[ slug ] || } - - { name } - { description } - - - ); - return ( - - { contents } - + ); } }
{ __( 'Authorized Google as', 'newspack' ) }{' '} { userBasicInfo.email }
{ __( 'Authorize Newspack with Google', 'newspack' ) }
{ description }