Skip to content

Commit a4e6742

Browse files
[Brand Refactor] Tiles gridlines update (#1364)
1 parent 6fd28ee commit a4e6742

5 files changed

Lines changed: 51 additions & 1 deletion

File tree

.changeset/bright-tiles-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react-brand': patch
3+
---
4+
5+
Hide lateral gridline borders for underfilled `Tiles` rows.

packages/react/src/Tiles/Tiles.features.stories.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react'
22
import type {Meta, StoryObj} from '@storybook/react'
33
import {Tiles} from './Tiles'
44
import {Section} from '../Section'
5+
import {Stack} from '../Stack'
56
import {tileItems} from './Tiles.fixtures'
67

78
const meta = {
@@ -41,6 +42,31 @@ export const GridlinesVariant: Story = {
4142
),
4243
}
4344

45+
export const GridlinesUnderfilledRows: Story = {
46+
render: () => (
47+
<Stack gap="spacious" padding="none">
48+
<Section>
49+
<Tiles variant="gridlines">
50+
{tileItems.slice(0, 5).map((item, index) => (
51+
<Tiles.Item key={`${item.name}-${index}`} name={item.name} href={item.href}>
52+
{item.icon}
53+
</Tiles.Item>
54+
))}
55+
</Tiles>
56+
</Section>
57+
<Section>
58+
<Tiles variant="gridlines" layout="compact">
59+
{tileItems.slice(0, 7).map((item, index) => (
60+
<Tiles.Item key={`${item.name}-${index}`} name={item.name} href={item.href}>
61+
{item.icon}
62+
</Tiles.Item>
63+
))}
64+
</Tiles>
65+
</Section>
66+
</Stack>
67+
),
68+
}
69+
4470
export const CompactLayout: Story = {
4571
render: () => (
4672
<Section>

packages/react/src/Tiles/Tiles.module.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
}
3939

4040
.Tiles--variant-gridlines .Tiles-grid {
41+
--tiles-grid-border-color: var(--brand-color-border-muted);
4142
position: relative;
4243
padding-right: var(--brand-borderWidth-thin);
4344
padding-bottom: var(--brand-borderWidth-thin);
@@ -50,7 +51,7 @@
5051
top: 0;
5152
bottom: 0;
5253
width: 0;
53-
border-left: var(--brand-borderWidth-thin) solid var(--brand-color-border-muted);
54+
border-left: var(--brand-borderWidth-thin) solid var(--tiles-grid-border-color);
5455
z-index: 1;
5556
pointer-events: none;
5657
}
@@ -63,6 +64,13 @@
6364
right: 0;
6465
}
6566

67+
@media screen and (min-width: 63.25rem) {
68+
.Tiles--variant-gridlines.Tiles--layout-default .Tiles-grid:not(:has(> .Tiles-item:nth-child(6))),
69+
.Tiles--variant-gridlines.Tiles--layout-compact .Tiles-grid:not(:has(> .Tiles-item:nth-child(8))) {
70+
--tiles-grid-border-color: transparent;
71+
}
72+
}
73+
6674
.Tiles-item {
6775
--tiles-inset-shadow: inset 0 0 0 transparent;
6876
position: relative;

packages/react/src/Tiles/Tiles.visual.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ test.describe('Visual Comparison: Tiles', () => {
4949
await expect(page).toHaveScreenshot({fullPage: true})
5050
})
5151

52+
test('Tiles / Gridlines Underfilled Rows', async ({page}) => {
53+
await page.goto(
54+
'http://localhost:6006/iframe.html?args=&id=components-tiles-features--gridlines-underfilled-rows&viewMode=story',
55+
{waitUntil: 'networkidle'},
56+
)
57+
await page.locator('body.sb-show-main').waitFor({state: 'visible'})
58+
59+
await page.waitForTimeout(500)
60+
await expect(page).toHaveScreenshot({fullPage: true})
61+
})
62+
5263
test('Tiles / Compact Layout', async ({page}) => {
5364
await page.goto(
5465
'http://localhost:6006/iframe.html?args=&id=components-tiles-features--compact-layout&viewMode=story',
20.8 KB
Loading

0 commit comments

Comments
 (0)