Skip to content

Commit

Permalink
Update Pillar styles (#370)
Browse files Browse the repository at this point in the history
* Pillar site refactor updates
  • Loading branch information
Josep Martins authored Aug 4, 2023
1 parent 81abab1 commit 6e8a648
Show file tree
Hide file tree
Showing 19 changed files with 46 additions and 17 deletions.
11 changes: 11 additions & 0 deletions .changeset/ten-ways-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@primer/react-brand': patch
---

Updates `Pillar` icon size, spacing and font settings.

- updated icon size to be medium (32px)
- updated heading font settings to use size 6 (20px/14px)
- updated spacing between icon and heading, heading and description, description and link
- updated link spacing to use margin-top: auto. This property adjust the position depending on it's sibling height size.
- added stacked with link story
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 21 additions & 4 deletions packages/react/src/Pillar/Pillar.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ type FixtureData = {

export const Stacked: StoryFn<typeof Pillar> = () => {
return (
<Stack direction="horizontal" gap={'spacious'} padding={'spacious'}>
<Stack direction={{narrow: 'vertical', regular: 'horizontal'}} gap="spacious" padding="spacious">
{fixtureData.map(({heading, description, icon, iconColor}, id) => {
return (
<Pillar key={id} style={{width: '33.3333%'}}>
<Pillar key={id} style={{flex: 1}}>
<Pillar.Icon icon={icon} color={iconColor} />
<Pillar.Heading>{heading}</Pillar.Heading>
<Pillar.Description>{description}</Pillar.Description>
Expand All @@ -163,10 +163,10 @@ export const Stacked: StoryFn<typeof Pillar> = () => {

export const StackedCentered: StoryFn<typeof Pillar> = () => {
return (
<Stack direction="horizontal" gap={'spacious'} padding={'spacious'}>
<Stack direction={{narrow: 'vertical', regular: 'horizontal'}} gap="spacious" padding="spacious">
{fixtureData.map(({heading, description, icon, iconColor}, id) => {
return (
<Pillar align="center" key={id} style={{width: '33.3333%'}}>
<Pillar align="center" key={id} style={{flex: 1}}>
<Pillar.Icon icon={icon} color={iconColor} />
<Pillar.Heading>{heading}</Pillar.Heading>
<Pillar.Description>{description}</Pillar.Description>
Expand All @@ -176,3 +176,20 @@ export const StackedCentered: StoryFn<typeof Pillar> = () => {
</Stack>
)
}

export const StackedWithLink: StoryFn<typeof Pillar> = () => {
return (
<Stack direction={{narrow: 'vertical', regular: 'horizontal'}} gap="spacious" padding="spacious">
{fixtureData.map(({heading, description, icon, iconColor, href}, id) => {
return (
<Pillar key={id} style={{flex: 1}}>
<Pillar.Icon icon={icon} color={iconColor} />
<Pillar.Heading>{heading}</Pillar.Heading>
<Pillar.Description>{description}</Pillar.Description>
<Pillar.Link href={href}>Read the documentation</Pillar.Link>
</Pillar>
)
})}
</Stack>
)
}
15 changes: 4 additions & 11 deletions packages/react/src/Pillar/Pillar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,19 @@

.Pillar__icon {
display: flex;
margin-bottom: var(--base-size-8);
margin-bottom: var(--base-size-24);
}

.Pillar__heading {
margin-bottom: var(--base-size-4);
}

/* Overrides the default size 6 to have a smaller font size, using 300 values instead of 400 */
.Pillar__heading.Pillar__heading--size-6 {
font-size: var(--brand-text-size-300);
line-height: var(--brand-text-lineHeight-300);
letter-spacing: var(--brand-heading-letterSpacing-300);
margin-bottom: var(--base-size-16);
}

.Pillar__description {
color: var(--brand-color-text-muted);
margin-bottom: var(--base-size-24);
}

.Pillar__link {
margin-top: var(--base-size-8);
margin-top: auto;
}

.Pillar__icon--color-default {
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/Pillar/Pillar.module.css.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ declare const styles: {
readonly "Pillar--align-start": string;
readonly "Pillar__icon": string;
readonly "Pillar__heading": string;
readonly "Pillar__heading--size-6": string;
readonly "Pillar__description": string;
readonly "Pillar__link": string;
readonly "Pillar__icon--color-default": string;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Pillar/Pillar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function PillarIcon({icon: Icon, className, color = defaultPillarIconColor, ...r
return (
<span className={clsx(styles.Pillar__icon, styles[`Pillar__icon--color-${color}`], className)} {...rest}>
{typeof Icon === 'function' ? (
<Icon size={24} />
<Icon size="medium" />
) : (
React.isValidElement(Icon) &&
React.cloneElement(Icon as React.ReactElement, {
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/Pillar/Pillar.visual.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ test.describe('Visual Comparison: Pillar', () => {
expect(await page.screenshot()).toMatchSnapshot()
})

test('Pillar / Stacked With Link', async ({page}) => {
await page.goto(
'http://localhost:6006/iframe.html?args=&id=components-pillar-features--stacked-with-link&viewMode=story',
)

await page.waitForTimeout(500)
expect(await page.screenshot()).toMatchSnapshot()
})

test('Pillar / Default', async ({page}) => {
await page.goto('http://localhost:6006/iframe.html?args=&id=components-pillar--default&viewMode=story')

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6e8a648

Please sign in to comment.