Skip to content

Commit 5fdd5ca

Browse files
p-jacksonzaguiini
andauthored
Replace all FullWidthLayout with WideLayout (#102259)
* Replace all FullWidthLayout with WideLayout * Domains' side content uses full width of its column in StepContainerV2's version * Rename prop to maxWidth * Remove huge-plus * Use CSS grid in ContentWrapper * Do not use column layout on mobile devices * ContentWrapper widths match mockup The mockups use standard widths for the step content wrapper, however they don't include the margin at the edge of the screen inside that total. This means the goals step heading now wraps the way expected from the mockup. * Use column max width calculation instead of using CSS grid * Cast inline CSS as CSSProperties * Remove leftover grid rule * Remove redundant max-width rules * Fix wide sidebar at checkout * Remove unused footer prop from wireframes * Remove unnecessary wrapper div and rename Content to ContentRow --------- Co-authored-by: Luis Felipe Zaguini <luisfelipezaguini@gmail.com>
1 parent a9735d2 commit 5fdd5ca

File tree

29 files changed

+274
-309
lines changed

29 files changed

+274
-309
lines changed

client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/unified-design-picker-preview.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ const UnifiedDesignPickerPreview = ( {
651651
if ( isUsingStepContainerV2 ) {
652652
// TODO: Create a new wireframe for the design preview. It should be named "FixedColumnOnTheLeftLayout"
653653
return (
654-
<Step.FullWidthLayout
654+
<Step.WideLayout
655+
maxWidth="xhuge"
655656
className="step-container-v2--design-picker-preview"
656657
topBar={ ( { isLargeViewport } ) => {
657658
if ( ! isLargeViewport && activeScreen ) {
@@ -719,7 +720,7 @@ const UnifiedDesignPickerPreview = ( {
719720
} }
720721
>
721722
{ stepContent }
722-
</Step.FullWidthLayout>
723+
</Step.WideLayout>
723724
);
724725
}
725726

client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/unified-design-picker.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ const UnifiedDesignPickerStep: StepType< {
450450
if ( isUsingStepContainerV2 ) {
451451
return (
452452
<Step.WideLayout
453+
maxWidth="huge"
453454
className="step-container-v2--design-picker"
454455
topBar={
455456
<Step.TopBar

client/landing/stepper/declarative-flow/internals/steps-repository/playground/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ export const PlaygroundStep: StepType = ( { navigation, flow } ) => {
3838
return (
3939
<>
4040
<DocumentHead title={ __( 'Playground' ) } />
41-
<Step.FullWidthLayout
41+
<Step.PlaygroundLayout
4242
className="playground-v2"
43-
hasContentPadding={ false }
4443
topBar={
4544
<Step.TopBar
4645
rightElement={
@@ -56,7 +55,7 @@ export const PlaygroundStep: StepType = ( { navigation, flow } ) => {
5655
playgroundClient={ playgroundClientRef.current }
5756
setPlaygroundClient={ setPlaygroundClient }
5857
/>
59-
</Step.FullWidthLayout>
58+
</Step.PlaygroundLayout>
6059
</>
6160
);
6261
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.playground__onboarding-iframe {
22
width: 100%;
3-
height: 100vh;
3+
height: 100%;
44
}

client/landing/stepper/declarative-flow/internals/steps-repository/unified-plans/unified-plans-step.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ function UnifiedPlansStep( {
495495
<>
496496
<MarketingMessage path="signup/plans" />
497497
<Step.WideLayout
498+
maxWidth="xhuge"
498499
className="step-container-v2--plans"
499500
topBar={
500501
<Step.TopBar

client/my-sites/checkout/src/components/checkout-main-content.tsx

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,8 @@ export default function CheckoutMainContent( {
838838

839839
return (
840840
<StepContainerV2CheckoutFixer isLargeViewport={ isLargeViewport }>
841-
<Step.FullWidthLayout
841+
<Step.WideLayout
842+
maxWidth="xhuge"
842843
hasContentPadding={ false }
843844
topBar={
844845
<Step.TopBar
@@ -855,15 +856,17 @@ export default function CheckoutMainContent( {
855856
}
856857
>
857858
{ content }
858-
</Step.FullWidthLayout>
859+
</Step.WideLayout>
859860
<LeaveCheckoutModal { ...leaveModalProps } />
860861
</StepContainerV2CheckoutFixer>
861862
);
862863
}
863864

864865
const StepContainerV2CheckoutFixer = styled.div< { isLargeViewport: boolean } >`
865-
.checkout-wrapper {
866-
margin-top: calc( var( --step-container-v2-top-bar-height ) * -1 );
866+
// This shouldn't exist. It's a hack to make the top bar appear on top of the checkout sidebar, which extends from the top of the page.
867+
.step-container-v2__top-bar {
868+
position: relative;
869+
z-index: 1;
867870
}
868871
869872
.checkout-skip-button {
@@ -876,18 +879,16 @@ const StepContainerV2CheckoutFixer = styled.div< { isLargeViewport: boolean } >`
876879
}
877880
}
878881
879-
// This shouldn't exist. It's a hack to make the top bar appear on top of the checkout sidebar, which extends from the top of the page.
880-
// A potentially better solution here is to make the dark area of checkout a pseudo-element and use negative z-index to bring the top bar above it, or use pointer-events: none.
881-
.step-container-v2__top-bar {
882-
position: relative;
883-
z-index: 1;
882+
.checkout-sidebar-plan-upsell {
883+
margin-inline: 0;
884+
max-width: 100%;
884885
}
885886
886887
${ ( props ) =>
887888
! props.isLargeViewport &&
888889
css`
889890
.checkout-sidebar-content {
890-
margin-top: var( --step-container-v2-top-bar-height );
891+
margin-top: 0;
891892
}
892893
893894
.checkout__summary-button {
@@ -953,8 +954,36 @@ const StepContainerV2CheckoutFixer = styled.div< { isLargeViewport: boolean } >`
953954
${ ( props ) =>
954955
props.isLargeViewport &&
955956
css`
956-
.checkout__summary-area {
957-
transform: translateY( -54px );
957+
.checkout-main-content {
958+
padding-left: var( --step-container-v2-content-inline-padding );
959+
margin-top: 3rem;
960+
}
961+
962+
.checkout-sidebar-content {
963+
--left-padding: 3.875rem;
964+
padding: 2.25rem var( --step-container-v2-content-inline-padding ) 0 var( --left-padding );
965+
background: none;
966+
position: relative;
967+
height: 100%;
968+
969+
&:before {
970+
content: '';
971+
display: block;
972+
background: var( --color-neutral-0 );
973+
position: fixed;
974+
top: calc( var( --step-container-v2-top-bar-height ) * -1 );
975+
transform: translateX( calc( var( --left-padding ) * -1 ) );
976+
width: 100vw;
977+
bottom: 0;
978+
}
979+
}
980+
981+
.checkout-summary-area {
982+
max-width: 100%;
983+
}
984+
985+
.checkout__summary-body {
986+
margin: 0;
958987
}
959988
` }
960989
`;

client/my-sites/marketing/do-it-for-me/faq.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ const FAQHeader = styled.h1`
1919

2020
const FAQSection = styled.div`
2121
width: 100%;
22-
max-width: 615px;
23-
margin: 0 auto;
2422
`;
2523

2624
const FAQExpander = styled( Button )`

client/signup/steps/domains/style.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,6 @@ body.is-section-signup {
546546
margin: 0;
547547
flex: 1;
548548
width: 100%;
549-
550-
@include break-large {
551-
max-width: 290px;
552-
}
553549
}
554550

555551
.domains__domain-side-content.fade-out {

packages/onboarding/src/step-container-v2/README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Read the [how to extend it](#how-to-extend-it) section to learn how to reproduce
5050

5151
**You shouldn't use `StepContainerV2` directly. Instead, use the wireframes that are exported from this package.**
5252

53-
Aside from the stories (run `yarn storybook`), you can follow the examples from `~/client/landing/stepper/declarative-flow/internals/steps-repository`.
53+
Aside from the stories (run `yarn storybook:start`), you can follow the examples from `~/client/landing/stepper/declarative-flow/internals/steps-repository`.
5454

5555
Please do NOT override the `Step.*` components with CSS as this creates inconsistencies between steps and becomes a maintenance nightmare. Ideally, you should not need to do this as the steps are designed to be composed, and the wireframes are approved by the designers.
5656

@@ -103,15 +103,18 @@ export const HorizontalLayout = ( {
103103
<>
104104
<TopBarRenderer topBar={ topBar } />
105105
<ContentWrapper width="wide" centerAligned={ context.isSmallViewport }>
106-
<Content className="step-container-v2__content--horizontal-layout">
107-
<div className="step-container-v2__content--horizontal-layout-left">
106+
<ContentRow
107+
columns={ 10 }
108+
className="step-container-v2__content-row--horizontal-layout"
109+
>
110+
<div className="step-container-v2__content-row--horizontal-layout-left">
108111
{ heading }
109112
{ imageUrl && <img src={ imageUrl } alt="" /> }
110113
</div>
111-
<div className="step-container-v2__content--horizontal-layout-right">
114+
<div className="step-container-v2__content-row--horizontal-layout-right">
112115
{ content }
113116
</div>
114-
</Content>
117+
</ContentRow>
115118
{ footer }
116119
</ContentWrapper>
117120
<StickyBottomBarRenderer stickyBottomBar={ stickyBottomBar } />
@@ -126,7 +129,7 @@ export const HorizontalLayout = ( {
126129
Then, we need to add the styles for the new wireframe. Let's create a new file called `style.scss` and add the following code:
127130

128131
```scss
129-
.step-container-v2__content--horizontal-layout {
132+
.step-container-v2__content-row--horizontal-layout {
130133
display: flex;
131134
flex-direction: column;
132135
gap: 3rem;
@@ -136,12 +139,12 @@ Then, we need to add the styles for the new wireframe. Let's create a new file c
136139
}
137140
}
138141

139-
.step-container-v2__content--horizontal-layout-left,
140-
.step-container-v2__content--horizontal-layout-right {
142+
.step-container-v2__content-row--horizontal-layout-left,
143+
.step-container-v2__content-row--horizontal-layout-right {
141144
flex: 1;
142145
}
143146

144-
.step-container-v2__content--horizontal-layout-left {
147+
.step-container-v2__content-row--horizontal-layout-left {
145148
display: flex;
146149
flex-direction: column;
147150
align-items: flex-start;
@@ -163,13 +166,13 @@ Let's modify the `children` of `HorizontalLayout` to reflect this new requiremen
163166
<>
164167
<TopBarRenderer topBar={ topBar } />
165168
<ContentWrapper width="wide" centerAligned={ context.isSmallViewport }>
166-
<Content className="step-container-v2__content--horizontal-layout">
167-
<div className="step-container-v2__content--horizontal-layout-left">
169+
<ContentRow columns={ 10 } className="step-container-v2__content-row--horizontal-layout">
170+
<div className="step-container-v2__content-row--horizontal-layout-left">
168171
{ heading }
169172
{ context.isSmallViewport && imageUrl && <img src={ imageUrl } alt="" /> }
170173
</div>
171-
<div className="step-container-v2__content--horizontal-layout-right">{ content }</div>
172-
</Content>
174+
<div className="step-container-v2__content-row--horizontal-layout-right">{ content }</div>
175+
</ContentRow>
173176
{ footer }
174177
</ContentWrapper>
175178
<StickyBottomBarRenderer stickyBottomBar={ stickyBottomBar } />
@@ -218,6 +221,15 @@ Of course not! The plan is for this new version to replace `StepContainer` entir
218221

219222
There's an utility called `shouldUseStepContainerV2` that allows, at a step level, to define which flows should render this version of the container vs. the original one.
220223

224+
### How do I run storybook?
225+
226+
Either:
227+
228+
- `yarn storybook:start` from the root of this package, or
229+
- `yarn workspace @automattic/onboarding storybook:start` from the root of the monorepo.
230+
231+
Storybook will open a browser window automatically.
232+
221233
### Who can I contact if I have any questions?
222234

223235
Ping @quake-team on Slack.

packages/onboarding/src/step-container-v2/components/Content/Content.tsx

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/onboarding/src/step-container-v2/components/Content/style.scss

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import clsx from 'clsx';
2+
import type { CSSProperties, ReactNode } from 'react';
3+
4+
import './style.scss';
5+
6+
export const ContentRow = ( {
7+
children,
8+
columns = 12,
9+
className,
10+
}: {
11+
children: ReactNode;
12+
columns?: number;
13+
className?: string;
14+
} ) => {
15+
return (
16+
<div
17+
className={ clsx( 'step-container-v2__content-row', className ) }
18+
style={ { '--columns': columns } as CSSProperties }
19+
>
20+
{ children }
21+
</div>
22+
);
23+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@import '@wordpress/base-styles/breakpoints';
2+
@import '@wordpress/base-styles/mixins';
3+
4+
.step-container-v2__content-row {
5+
width: 100%;
6+
max-width: 100%;
7+
8+
@include break-small {
9+
--total-column-width: calc(
10+
var( --columns ) * var( --step-container-v2-content-column-width )
11+
);
12+
--total-gap-width: calc(
13+
( var( --columns ) - 1 ) * var( --step-container-v2-content-column-gap )
14+
);
15+
16+
max-width: calc( var( --total-gap-width ) + var( --total-column-width ) );
17+
}
18+
}

packages/onboarding/src/step-container-v2/components/ContentWrapper/ContentWrapper.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import clsx from 'clsx';
2-
import { ReactNode } from 'react';
2+
import type { ReactNode } from 'react';
33

44
import './style.scss';
55

6+
type MaxWidth = 'wide' | 'huge' | 'xhuge';
7+
68
export const ContentWrapper = ( {
79
children,
8-
width,
10+
maxWidth = 'wide',
911
centerAligned,
1012
hasPadding = true,
1113
}: {
1214
children: ReactNode;
13-
width?: 'wide' | 'full';
15+
maxWidth?: MaxWidth;
1416
centerAligned?: boolean;
1517
hasPadding?: boolean;
1618
} ) => {
1719
return (
1820
<div
19-
className={ clsx( 'step-container-v2__content-wrapper', {
20-
wide: width === 'wide',
21-
full: width === 'full',
21+
className={ clsx( 'step-container-v2__content-wrapper', maxWidth, {
2222
'center-aligned': centerAligned,
2323
padding: hasPadding,
2424
} ) }

0 commit comments

Comments
 (0)