Skip to content

Commit

Permalink
Add @automattic/onboarding package to standardize stylesheets & reuse…
Browse files Browse the repository at this point in the history
… components. (#44077)

* Added @automattic/onboarding.

* Refactor calypso's typography.scss to @automattic/typography package. Renamed sass folder to styles. Added variables file.

* Updated gutenboarding to use @automattic/onboarding package.

* Updated @automattic/domain-picker to use @automattic/onboarding package.

* Updated @automattic/plans-grid to use @automattic/onboarding package.

* Updated magic-login, wp-login & signup to use mixins from @automattic/onboarding package.

* Update plans grid typography import path.

* Updated wpcom-block-editor-nux plugin to import fonts & mixins from @automattic/typography & @automattic/onboarding.

* Added yarn.lock file.

* Updated site-launch plugin typography import path.

* Move ActionButtons, BackButton, NextButton & SkipButton to @automattic/onboarding.

* Move onboarding-z-index() @automattic/onboarding.

* Added missing dependencies for action buttons.

* Maybe this will fix the failing build.

* Add missing @automattic/typography dependency.

* Add @automattic/typography to FSE.
  • Loading branch information
yansern authored Jul 14, 2020
1 parent 323752f commit a83f9ac
Show file tree
Hide file tree
Showing 58 changed files with 508 additions and 502 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '~@automattic/typography/sass/fonts';
@import '~@automattic/typography/styles/fonts';

.plans-modal-overlay {
&.components-modal__screen-overlay {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '~@automattic/typography/sass/fonts';
@import '~@automattic/typography/styles/fonts';

.nux-launch-step {
// TODO: container padding/margin with mobile breakpoints goes here.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
// @see client/landing/gutenboarding/mixins.scss
@font-face {
font-display: swap;
font-family: 'Recoleta';
font-weight: 400;
src: url( 'https://s1.wp.com/i/fonts/recoleta/400.eot' );
src: url( 'https://s1.wp.com/i/fonts/recoleta/400.eot?#iefix' ) format( 'embedded-opentype' ),
url( 'https://s1.wp.com/i/fonts/recoleta/400.woff2' ) format( 'woff2' ),
url( 'https://s1.wp.com/i/fonts/recoleta/400.woff' ) format( 'woff' ),
url( 'https://s1.wp.com/i/fonts/recoleta/400.ttf' ) format( 'truetype' );
}
@mixin onboarding-font-recoleta {
font-family: Recoleta, Georgia, 'Times New Roman', Times, serif;
font-weight: 400;
letter-spacing: 0.2px;
}
@import '~@automattic/typography/styles/fonts';
@import '~@automattic/onboarding/styles/mixins';

$wpcom-modal-breakpoint: 660px;

Expand Down
3 changes: 2 additions & 1 deletion apps/full-site-editing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"@automattic/domain-picker": "^1.0.0-alpha.0",
"@automattic/format-currency": "^1.0.0-alpha.0",
"@automattic/plans-grid": "^1.0.0-alpha.0",
"@automattic/typography": "^1.0.0",
"@wordpress/api-fetch": "*",
"@wordpress/base-styles": "1.9.0",
"@wordpress/block-editor": "*",
Expand Down Expand Up @@ -127,8 +128,8 @@
"moment": "*",
"newspack-blocks": "github:Automattic/newspack-blocks#v1.7.0",
"react": "^16.12.0",
"redux": "^4.0.5",
"react-dom": "^16.12.0",
"redux": "^4.0.5",
"utility-types": "^3.10.0"
},
"devDependencies": {
Expand Down
49 changes: 2 additions & 47 deletions client/assets/stylesheets/shared/_typography.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
// Brand font

@import '~@automattic/typography/sass/fonts';

// Typeface Variables

$monospace: 'Courier 10 Pitch', Courier, monospace;
$code: Monaco, Consolas, 'Andale Mono', 'DejaVu Sans Mono', $monospace;

$serif-fallback: Georgia, 'Times New Roman', Times, serif;
$serif: 'Noto Serif', $serif-fallback;

$sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell',
'Helvetica Neue', sans-serif;
$sans-rtl: Tahoma, $sans;
@import '~@automattic/typography/styles/fonts';
@import '~@automattic/typography/styles/variables';

$signup-sans: 'Noto Sans', $sans;

Expand All @@ -23,35 +10,3 @@ $signup-sans: 'Noto Sans', $sans;
-moz-osx-font-smoothing: grayscale;
color: var( --color-text );
}

// ======================================================================
// Rem function
//
// Convert px to rem in a readable fashion.
//
// Example: font-size: rem( 21px );
// ======================================================================

$root-font-size: 16px;

@function rem( $pixels, $context: $root-font-size ) {
@return $pixels / $context * 1rem;
}

// NOTE:
// If there are exceptions to these stacks,
// please mark them with a //typography-exception comment
// so we can easily search for them later.

// Typography size variables

$font-headline-large: rem( 54px );
$font-headline-medium: rem( 48px );
$font-headline-small: rem( 36px );
$font-title-large: rem( 32px );
$font-title-medium: rem( 24px );
$font-title-small: rem( 20px );
$font-body: rem( 16px );
$font-body-small: rem( 14px );
$font-body-extra-small: rem( 12px );
$font-code: rem( 15px );
6 changes: 3 additions & 3 deletions client/landing/gutenboarding/components/header/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import 'assets/stylesheets/shared/mixins/placeholder'; // Contains the placeholder mixin
@import 'assets/stylesheets/shared/animation'; // Needed for the placeholder
@import '../../variables.scss';
@import '../../_z-index.scss';
@import '~@automattic/onboarding/styles/z-index';

$margin-left--gutenboarding__header-section-item: 13px; // matches design
$padding--gutenboarding__header: $grid-unit-10;
Expand Down Expand Up @@ -35,9 +35,9 @@ $padding--gutenboarding__header: $grid-unit-10;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid $light-gray-500;
height: $gutenboarding-header-height;
height: $onboarding-header-height;
background: $white;
z-index: gutenboarding-z-index( '.gutenboarding__header' );
z-index: onboarding-z-index( '.onboarding__header' );
left: 0;
right: 0;
// Stick the toolbar to the top, because the admin bar is not fixed on mobile.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import { useDispatch, useSelect } from '@wordpress/data';
import { Button } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import PlansGrid from '@automattic/plans-grid';
import { Title, SubTitle, ActionButtons } from '@automattic/onboarding';

/**
* Internal dependencies
*/
import { PLANS_STORE } from '../../stores/plans';
import { useTrackModal } from '../../hooks/use-track-modal';
import { useSelectedPlan } from '../../hooks/use-selected-plan';
import ActionButtons from '../action-buttons';
import { Title, SubTitle } from '../titles';
import { STORE_KEY as ONBOARD_STORE } from '../../stores/onboard';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
display: flex;
align-items: center;
justify-content: space-between;
height: $gutenboarding-header-height;
height: $onboarding-header-height;
background: $white;

left: 0;
Expand Down
165 changes: 1 addition & 164 deletions client/landing/gutenboarding/mixins.scss
Original file line number Diff line number Diff line change
@@ -1,164 +1 @@
@import './variables.scss';
@import 'assets/stylesheets/gutenberg-base-styles';

@mixin onboarding-font-recoleta {
font-family: Recoleta, Georgia, 'Times New Roman', Times, serif;
font-weight: 400;
letter-spacing: -0.4px;
}

@mixin onboarding-heading-text {
@include onboarding-font-recoleta;
font-size: 42px;
line-height: 57px;
}

@mixin onboarding-heading-text-tablet {
@include onboarding-font-recoleta;
font-size: 36px;
line-height: 40px;
}

@mixin onboarding-heading-text-mobile {
@include onboarding-font-recoleta;
font-size: 32px;
line-height: 40px;
}

@mixin onboarding-large-text {
font-size: 16px;
line-height: 24px;
}

@mixin onboarding-medium-text {
font-size: $font-body-small;
line-height: 17px;
}

@mixin onboarding-small-text {
font-size: $font-body-extra-small;
line-height: 14px;
}

@mixin onboarding-x-small-text {
font-size: $font-body-extra-small;
line-height: 13px;
}

@mixin onboarding-block-margin {
margin: 0 $gutenboarding-block-margin-mobile;

@include break-small {
margin: 0 $gutenboarding-block-margin-small;
}

@include break-medium {
margin: 0 $gutenboarding-block-margin-medium;
}
}

@mixin onboarding-heading-padding {
margin: $gutenboarding-heading-padding-mobile;

@include break-mobile {
margin: $gutenboarding-heading-padding-desktop;
}
}

/* (1920x1080) Full HD Display */
@mixin onboarding-break-gigantic() {
@media ( min-width: 1920px ) {
@content;
}
}

@mixin onboarding-break-mobile-tall() {
@media ( min-height: 750px ) {
@content;
}
}

@mixin onboarding-modal-overlay {
// Absolute positioning allows the modal
// to reuse the <body> element's scrollbar.
position: absolute;

// This positions the domain picker modal
// right below the gutenboarding header,
// keeping the header clickable.
top: $gutenboarding-header-height;
left: 0;

// Using min-height lets the overlay cover
// the entire viewport ensuring nothing behind
// it can be seen.
//
// When the domain picker's content is taller
// than the viewport height, it will expand taller
// than the provided min-height, triggering
// the appearance of the <body> element's scrollbar.
min-height: calc( 100vh - #{$gutenboarding-header-height} );
width: 100%;

background: var( --studio-white );
}

@mixin onboarding-block-edge2edge-container {
width: calc( 100% + #{$gutenboarding-block-margin-mobile * 2} );
margin-left: #{$gutenboarding-block-margin-mobile * -1};
margin-right: #{$gutenboarding-block-margin-mobile * -1};

@include break-small {
width: calc( 100% + #{$gutenboarding-block-margin-small * 2} );
margin-left: #{$gutenboarding-block-margin-small * -1};
margin-right: #{$gutenboarding-block-margin-small * -1};
}

@include break-medium {
width: calc( 100% + #{$gutenboarding-block-margin-medium * 2} );
margin-left: #{$gutenboarding-block-margin-medium * -1};
margin-right: #{$gutenboarding-block-margin-medium * -1};
}
}

@mixin onboarding-block-edge2edge-content {
border-left: $gutenboarding-block-margin-mobile solid transparent;
border-right: $gutenboarding-block-margin-mobile solid transparent;

@include break-small {
border-left: $gutenboarding-block-margin-small solid transparent;
border-right: $gutenboarding-block-margin-small solid transparent;
}

@include break-medium {
border-left: $gutenboarding-block-margin-medium solid transparent;
border-right: $gutenboarding-block-margin-medium solid transparent;
}
}

@mixin onboarding-block-edge2edge-columns {
&:first-child {
border-left: $gutenboarding-block-margin-mobile solid transparent;
}
&:last-child {
border-right: $gutenboarding-block-margin-mobile solid transparent;
}

@include break-small {
&:first-child {
border-left: $gutenboarding-block-margin-small solid transparent;
}
&:last-child {
border-right: $gutenboarding-block-margin-small solid transparent;
}
}

@include break-medium {
&:first-child {
border-left: $gutenboarding-block-margin-medium solid transparent;
}
&:last-child {
border-right: $gutenboarding-block-margin-medium solid transparent;
}
}
}
@import '~@automattic/onboarding/styles/mixins';
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import * as React from 'react';
import classnames from 'classnames';
import { useSelect, useDispatch } from '@wordpress/data';
import { NextButton, SkipButton } from '@automattic/onboarding';

/**
* Internal dependencies
Expand All @@ -19,7 +20,6 @@ import { recordSiteTitleSkip } from '../../lib/analytics';
* Style dependencies
*/
import './style.scss';
import { NextButton, SkipButton } from 'landing/gutenboarding/components/action-buttons';

const AcquireIntent: React.FunctionComponent = () => {
const { getSelectedSiteTitle } = useSelect( ( select ) => select( STORE_KEY ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
background-color: var( --contrastColor );
color: var( --mainColor );
tab-size: 4;
min-height: calc( 100vh - 2 * #{$gutenboarding-header-height} );
min-height: calc( 100vh - 2 * #{$onboarding-header-height} );
width: 100%;
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useI18n } from '@automattic/react-i18n';
import Link from '../../components/link';
import { localizeUrl } from 'lib/i18n-utils';
import { SITE_STORE } from '../../stores/site';
import { Title, SubTitle } from '../../components/titles';
import { Title, SubTitle } from '@automattic/onboarding';

/**
* Style dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ import { Tooltip } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { useI18n } from '@automattic/react-i18n';
import React from 'react';
import { Title, SubTitle, ActionButtons, BackButton } from '@automattic/onboarding';

/**
* Internal dependencies
*/
import { STORE_KEY as ONBOARD_STORE } from '../../stores/onboard';
import { SubTitle, Title } from '../../components/titles';

import { useTrackStep } from '../../hooks/use-track-step';
import useStepNavigation from '../../hooks/use-step-navigation';
import Badge from '../../components/badge';
import designs, { getDesignImageUrl } from '../../available-designs';
import JetpackLogo from 'components/jetpack-logo'; // @TODO: extract to @automattic package
import type { Design } from '../../stores/onboard/types';
import ActionButtons, { BackButton } from '../../components/action-buttons';

/**
* Style dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.design-selector {
background-color: var( --contrastColor );
color: var( --mainColor );
padding-bottom: $gutenboarding-footer-height;
padding-bottom: $onboarding-footer-height;

.design-selector__header {
@include onboarding-heading-padding;
Expand Down
Loading

0 comments on commit a83f9ac

Please sign in to comment.