Skip to content

Untangled Plans: reduce plan grid breakpoints to compensate for site list sidebar #101603

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

Merged
merged 2 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions client/my-sites/plans-features-main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ const PlansFeaturesMain = ( {
intent={ intent }
isCustomDomainAllowedOnFreePlan={ isCustomDomainAllowedOnFreePlan }
isInAdmin={ ! isInSignup }
isInSiteDashboard={ isInSiteDashboard }
isInSignup={ isInSignup }
onStorageAddOnClick={ handleStorageAddOnClick }
paidDomainName={ paidDomainName }
Expand Down Expand Up @@ -920,6 +921,7 @@ const PlansFeaturesMain = ( {
intent={ intent }
intervalType={ intervalType }
isInAdmin={ ! isInSignup }
isInSiteDashboard={ isInSiteDashboard }
isInSignup={ isInSignup }
onStorageAddOnClick={ handleStorageAddOnClick }
planTypeSelectorProps={
Expand Down
4 changes: 4 additions & 0 deletions client/my-sites/plans-features-main/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ $plan-features-header-banner-height: 20px;
padding: 0 0 10px;
overflow-x: visible;
}

#site-plans & .plans-wrapper {
margin: 0;
}
}

.plans-features-main__comparison-grid-container {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const defaultProps = {
hideUnavailableFeatures: false,
intervalType: 'yearly',
isInAdmin: false,
isInSiteDashboard: false,
isInSignup: true,
onStorageAddOnClick: () => {},
planActionOverrides: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1104,14 +1104,6 @@ const ComparisonGrid = ( {
);
};

const GRID_BREAKPOINTS = new Map( [
[ 'small', 0 ],
[ 'smedium', 686 ],
[ 'medium', 835 ], // enough to fit Enterpreneur plan. was 686
[ 'large', 1005 ], // enough to fit Enterpreneur plan. was 870
[ 'xlarge', 1180 ],
] );

// TODO
// Now that everything under is functional component, we can deprecate this wrapper and only keep ComparisonGrid instead.
// More details can be found in https://github.com/Automattic/wp-calypso/issues/87047
Expand All @@ -1124,6 +1116,7 @@ const WrappedComparisonGrid = ( {
recordTracksEvent,
allFeaturesList,
intervalType,
isInSiteDashboard,
isInSignup,
currentSitePlanSlug,
selectedPlan,
Expand All @@ -1142,10 +1135,22 @@ const WrappedComparisonGrid = ( {
}: ComparisonGridExternalProps ) => {
const gridContainerRef = useRef< HTMLDivElement >( null );

const gridBreakpoints = useMemo( () => {
// we want to fit up to the Commerce plan in this breakpoint
const xlargeBreakpoint = isInSiteDashboard ? 1114 : 1180;
return new Map( [
[ 'small', 0 ],
[ 'smedium', 686 ],
[ 'medium', 835 ],
[ 'large', 1005 ],
[ 'xlarge', xlargeBreakpoint ],
] );
}, [ isInSiteDashboard ] );

// TODO: this will be deprecated along side removing the wrapper component
const gridSize = useGridSize( {
containerRef: gridContainerRef,
containerBreakpoints: GRID_BREAKPOINTS,
containerBreakpoints: gridBreakpoints,
} );

const classNames = clsx( 'plans-grid-next', className, {
Expand Down Expand Up @@ -1176,6 +1181,7 @@ const WrappedComparisonGrid = ( {
>
<ComparisonGrid
intervalType={ intervalType }
isInSiteDashboard={ isInSiteDashboard }
isInSignup={ isInSignup }
currentSitePlanSlug={ currentSitePlanSlug }
siteId={ siteId }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const defaultProps = {
hideUnavailableFeatures: false,
isCustomDomainAllowedOnFreePlan: false,
isInAdmin: false,
isInSiteDashboard: false,
isInSignup: true,
onStorageAddOnClick: () => {},
planActionOverrides: undefined,
Expand Down
30 changes: 21 additions & 9 deletions packages/plans-grid-next/src/components/features-grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ const WrappedFeaturesGrid = ( props: FeaturesGridExternalProps ) => {
allFeaturesList,
coupon,
isInAdmin,
isInSiteDashboard,
className,
enableFeatureTooltips,
enableCategorisedFeatures,
Expand All @@ -392,15 +393,26 @@ const WrappedFeaturesGrid = ( props: FeaturesGridExternalProps ) => {

const gridContainerRef = useRef< HTMLDivElement >( null );

const gridBreakpoints = useMemo(
() =>
new Map( [
[ 'small', 0 ],
[ 'medium', 740 ],
[ 'large', isInAdmin ? 1180 : 1320 ], // 1320 to fit Enterpreneur plan, 1180 to work in admin
] ),
[ isInAdmin ]
);
const gridBreakpoints = useMemo( () => {
// we want to fit up to the Commerce plan in this breakpoint
let largeBreakpoint;
if ( isInSiteDashboard ) {
largeBreakpoint = 1042;
} else if ( isInAdmin ) {
largeBreakpoint = 1180;
} else {
largeBreakpoint = 1320;
}

// we want to fit 3 plans per row in this breakpoint
const mediumBreakpoint = isInSiteDashboard ? 667 : 741;

return new Map( [
[ 'small', 0 ],
[ 'medium', mediumBreakpoint ],
[ 'large', largeBreakpoint ],
] );
}, [ isInAdmin, isInSiteDashboard ] );

// TODO: this will be deprecated along side removing the wrapper component
const gridSize = useGridSize( {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
padding: 10px 12px;
border: unset;
text-align: center;
text-wrap: balance;
width: 100%;
color: var(--color-text-inverted);

Expand Down
1 change: 1 addition & 0 deletions packages/plans-grid-next/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export interface CommonGridProps {
siteId?: number | null;
isInSignup: boolean;
isInAdmin: boolean;
isInSiteDashboard: boolean;
onStorageAddOnClick?: ( addOnSlug: AddOns.StorageAddOnSlug ) => void;
currentSitePlanSlug?: string | null;
hideUnavailableFeatures?: boolean; // used to hide features that are not available, instead of strike-through as explained in #76206
Expand Down