Skip to content

Commit 4c1e8eb

Browse files
authored
Merge pull request #478 from Codeinwp/feat/onboarding-4-sites-per-row
feat(onboarding): show 4 starter sites per row on laptop and up
2 parents 17e3e13 + 1f51577 commit 4c1e8eb

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

e2e-tests/specs/onboarding.spec.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ test.describe('Onboarding', () => {
4848
expect(await page.locator('.ss-card .ss-badge').count()).toBeGreaterThan(0);
4949

5050
// 'All' and 'Free' should show after you select a category.
51+
// Match exactly: card page-shot buttons (e.g. "Gallery", "Ballet Blog",
52+
// "All Courses") also contain "all" as a substring, so a non-exact name
53+
// match resolves to multiple elements once the grid renders a full page.
5154
await page.locator('.ob-cat-wrap').first().click();
52-
await expect(page.getByRole('button', { name: 'All' })).toBeVisible();
53-
await expect(page.getByRole('button', { name: 'Free' })).toBeVisible();
55+
await expect(page.getByRole('button', { name: 'All', exact: true })).toBeVisible();
56+
await expect(page.getByRole('button', { name: 'Free', exact: true })).toBeVisible();
5457

5558
// Check card structure.
5659
const firstListedSiteCard = page.locator('.ss-card-wrap').first();

onboarding/src/Components/Sites.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ const Sites = ( {
2727
sortBy,
2828
selectedColors,
2929
} ) => {
30-
const [ maxShown, setMaxShown ] = useState( 9 );
30+
const [ maxShown, setMaxShown ] = useState( 12 );
3131
const { sites = {} } = getSites;
3232

3333
useEffect( () => {
34-
setMaxShown( 9 );
34+
setMaxShown( 12 );
3535
}, [ editor, category, searchQuery, sortBy, selectedColors ] );
3636

3737
const getBuilders = () => Object.keys( sites );
@@ -218,9 +218,9 @@ const Sites = ( {
218218
const rest = filterByColors( filterByCategory( ranked, category ) ).filter(
219219
( site ) => site && site.slug && ! inMatches[ site.slug ]
220220
);
221-
const remainder = matches.length % 3;
221+
const remainder = matches.length % 4;
222222
const pad =
223-
remainder === 0 ? 0 : Math.min( 3 - remainder, rest.length );
223+
remainder === 0 ? 0 : Math.min( 4 - remainder, rest.length );
224224

225225
return {
226226
list: [ ...matches, ...rest ],
@@ -280,7 +280,7 @@ const Sites = ( {
280280
return false;
281281
}
282282

283-
setMaxShown( ( shown ) => shown + 9 );
283+
setMaxShown( ( shown ) => shown + 12 );
284284
} }
285285
>
286286
<span

onboarding/src/scss/_general.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ input.components-text-control__input[type="email"],
266266

267267
@mixin ob-general--laptop() {
268268
.ob-sites.is-grid {
269-
grid-template-columns: 1fr 1fr 1fr;
269+
grid-template-columns: repeat(4, minmax(0, 1fr));
270270
}
271271
}
272272

0 commit comments

Comments
 (0)