Skip to content

Commit 6f3db51

Browse files
authored
Merge branch 'main' into joshfarrant/videoplayer-tooltip-focus
2 parents e095224 + eba0c53 commit 6f3db51

17 files changed

+153
-22
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@primer/react-brand': patch
3+
---
4+
5+
Added image support to `Pillar` component
6+
7+
Usage example:
8+
9+
```jsx
10+
<Pillar>
11+
<Pillar.Image
12+
src="/path/to/your/image.jpg" alt="Required alternative text"
13+
/>
14+
<Pillar.Heading>Code search & code view</Pillar.Heading>
15+
<Pillar.Description>
16+
Enables you to rapidly search, navigate, and understand code, right from GitHub.com.
17+
</Pillar.Description>
18+
</Pillar>
19+
```
20+
21+
🔗 (See Storybook for an example)[https://primer.style/brand/storybook/?path=/story/components-pillar-features--with-image]

apps/docs/content/components/Card/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Cards should always be used in groups of two or more related concepts.
3030

3131
### Stacked
3232

33-
Cards should be stacked to display a list of items that are related to each other. If displaying a visual asset, do so for all cards to achieve a visually balanced layout. The visual asset should be the same type for all cards, either an icon or an image.
33+
Cards should be stacked to display a list of items that are related to each other. When displaying a visual asset, ensure it is consistent across all cards to create a visually balanced layout. The visual asset should be the same type for each card, either an icon or an image.
3434

3535
For a better visual experience, we recommend using similar length size for the heading and description in all stacked cards.
3636

@@ -123,7 +123,7 @@ The call to action label indicates the action or resource the card links to. It
123123

124124
### Border
125125

126-
Card offers a variation with a border. Border is disabled by default.
126+
Card offers a variation with a border. Border is disabled by default.
127127

128128
## Related components
129129

apps/docs/content/components/Card/react.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ Use the `Image` component to add an image to the `Card`. The `Image` component i
131131
<Card.Image
132132
src="https://via.placeholder.com/600x400/d3d9df/d3d9df.png"
133133
alt="placeholder, blank area with an gray background color"
134-
aspectRatio="16:9"
135134
/>
136135
<Card.Heading>Code search & code view</Card.Heading>
137136
<Card.Description>
476 KB
Loading
400 KB
Loading

apps/docs/content/components/Pillar/index.mdx

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ description: Use the pillar component to group related content together.
44
---
55

66
import ComponentLayout from '../../../src/layouts/component-layout'
7+
import doStackImages from './images/do-stack-images.png'
8+
import dontStackImages from './images/dont-stack-images.png'
9+
710
export default ComponentLayout
811

912
## Anatomy
@@ -17,34 +20,38 @@ export default ComponentLayout
1720

1821
## Usage
1922

20-
Use pillars to group similar features or benefits together to easily scan and read. Pillars display content in a familiar and recognizable style.
23+
Use pillars to display a collection of features or benefits, making them easier to scan and read. Pillars present content in a familiar and recognizable style.
2124

2225
### Stacked
2326

24-
Pillars should be stacked to display a list of items that are related to each other. Use consistent pillar sizes within a row or group. A group or a row of content pillars is more visually appealing when the widths and heights of all elements match, so keep the content lenght of each pillar consistent.
27+
Stack multiple pillars to create a collection of items. Ensure that all the items in a group have consistent content lengths so that their width and height match, making the content more visually appealing. When displaying a visual, create a balanced layout by using the same type for each pillar, either an icon or an image.
2528

2629
<DoDontContainer>
2730
<Do>
2831
<img src="https://github.com/primer/brand/assets/912236/cd9679ab-cfa0-4c6d-8a55-21d16668f1ca" />
2932
<Caption>
30-
Use a similar content size to achieve a visually balanced layout.
33+
Use similar character counts to achieve a visually balanced layout.
3134
</Caption>
3235
</Do>
3336
<Dont>
3437
<img src="https://github.com/primer/brand/assets/912236/cd6e471f-98cf-4c70-801f-c0aeb4d2bdf5" />
3538
<Caption>
36-
Don't use different length sizes for the title or the description.
39+
Avoid varying content lengths for the title and description.
3740
</Caption>
3841
</Dont>
3942
</DoDontContainer>
4043

41-
If displaying an icon, do so for all cards to achieve a visually balanced layout.
44+
<Note variant="warning">
45+
Use pillars with images only for groups of a maximum of three to six items.
46+
Avoid stacking multiple sections that each contain groups of six pillars.
47+
</Note>
4248

4349
<DoDontContainer>
4450
<Do>
4551
<img src="https://github.com/primer/brand/assets/912236/cdceda67-a911-40a0-839a-4620c83fe510" />
4652
<Caption>
47-
Use icons either for all pillars or none for a visually balanced layout.
53+
When using icons, add them to all pillars to create a visually balanced
54+
layout.
4855
</Caption>
4956
</Do>
5057
<Dont>
@@ -53,9 +60,23 @@ If displaying an icon, do so for all cards to achieve a visually balanced layout
5360
</Dont>
5461
</DoDontContainer>
5562

56-
When presenting more than four pillars, we recommend displaying them in multiple rows. You can use the [Grid](/components/Grid) or the [Stack](/components/Stack) component to achieve this. We recommend using a grid with 3 or 4 columns and balancing the number of pillars on each row.
63+
<DoDontContainer>
64+
<Do>
65+
<img alt="" src={doStackImages} />
66+
<Caption>
67+
When using images, add them to all pillars to create a visually balanced
68+
layout.
69+
</Caption>
70+
</Do>
71+
<Dont>
72+
<img alt="" src={dontStackImages} />
73+
<Caption>Don't use images with different aspect ratios.</Caption>
74+
</Dont>
75+
</DoDontContainer>
76+
77+
When presenting more than four pillars, we recommend displaying them in multiple rows. You can use the [Grid](/components/Grid) or the [Stack](/components/Stack) component to achieve this. We recommend using a grid with three or four columns and balancing the number of pillars on each row.
5778

58-
![An image showing a group of numerous Pillars stacked in a 3 column grid.](https://github.com/primer/brand/assets/912236/350c5eab-bd21-450c-a7a3-60e29c828a3f)
79+
![An image showing a group of numerous Pillars stacked in a three column grid.](https://github.com/primer/brand/assets/912236/350c5eab-bd21-450c-a7a3-60e29c828a3f)
5980

6081
### Pillar and Card
6182

@@ -71,18 +92,18 @@ Cards should be used for noteworthy information to immediately draw user attenti
7192

7293
#### Group size
7394

74-
Cards should be used in small groups (3, 4 or 5 items maximum), whereas Pillars can be used in larger (more than 5 items) or smaller groups. As users encounter an increasing number of items within a group, the distinctiveness of each individual element diminishes.
95+
Cards should be used in small groups of three to five items, while Pillars can accommodate larger groups of up to nine items, or six if using images. The more items in a group, the less distinctive each individual element becomes.
7596

7697
<DoDontContainer>
7798
<Do>
7899
<img src="https://github.com/primer/brand/assets/912236/bc33c846-71c2-4af6-a3ac-f886bad71995" />
79-
<Caption>Pillars are more suitable for groups of 5 or more items.</Caption>
100+
<Caption>Pillars are suitable for groups of up to six items.</Caption>
80101
</Do>
81102
<Dont>
82103
<img src="https://github.com/primer/brand/assets/912236/302dbc4d-6199-4c0c-96d5-76ac2e35fdea" />
83104
<Caption>
84-
Don't use Cards for groups of 5 or more items. Use them sparingly in
85-
groups of 3 or 4.
105+
Don't use Cards for groups of five or more items. Use them sparingly in
106+
groups of three or four.
86107
</Caption>
87108
</Dont>
88109
</DoDontContainer>

apps/docs/content/components/Pillar/react.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ You can add an `icon` to enhance the visual context. We recommend using an [Octi
4949
</Pillar>
5050
```
5151

52+
### Image
53+
54+
You can add an image to enhance the visual context.
55+
56+
```jsx live
57+
<Pillar>
58+
<Pillar.Image
59+
src="https://via.placeholder.com/600x400/d3d9df/d3d9df.png"
60+
alt="placeholder, blank area with an gray background color"
61+
/>
62+
<Pillar.Heading>Code search & code view</Pillar.Heading>
63+
<Pillar.Description>
64+
Enables you to rapidly search, navigate, and understand code, right from
65+
GitHub.com.
66+
</Pillar.Description>
67+
</Pillar>
68+
```
69+
5270
### Link
5371

5472
You can add an external link to the Pillar using the `Link` component.
@@ -130,6 +148,10 @@ Use the `Stack` component to stack multiple Pillars horizontally or vertically.
130148
| `icon` | `React.Node` | | `true` | Octicon |
131149
| `color` | <PropTableValues values={PillarIconColors} addLineBreaks /> | `default` | `false` | The color of the Pillar icon |
132150

151+
### Pillar.Image
152+
153+
Forwards all the props from the [Image component](/components/Image), including `src`, `alt`, and `aspectRatio`.
154+
133155
### Pillar.Heading
134156

135157
| name | type | default | required | description |

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import startShape from '../fixtures/images/testimonial-bg-1.png'
88
import endShape from '../fixtures/images/testimonial-bg-2.png'
99

1010
import styles from './Pillar.stories.module.css'
11+
import placeholderImage from '../fixtures/images/placeholder-600x400.png'
1112

1213
export default {
1314
title: 'Components/Pillar/features',
1415
component: Pillar,
1516
} as Meta<typeof Pillar>
1617

17-
export const Icon: StoryFn<typeof Pillar> = () => {
18+
export const WithIcon: StoryFn<typeof Pillar> = () => {
1819
return (
1920
<Pillar>
2021
<Pillar.Icon icon={<RocketIcon />} />
@@ -26,7 +27,23 @@ export const Icon: StoryFn<typeof Pillar> = () => {
2627
)
2728
}
2829

29-
export const IconColors: StoryFn<typeof Pillar> = () => {
30+
export const WithImage: StoryFn<typeof Pillar> = () => {
31+
return (
32+
<Pillar>
33+
<Pillar.Image
34+
aspectRatio="16:10"
35+
src={placeholderImage}
36+
alt="placeholder, blank area with a gray background color"
37+
/>
38+
<Pillar.Heading>Code search & code view</Pillar.Heading>
39+
<Pillar.Description>
40+
Enables you to rapidly search, navigate, and understand code, right from GitHub.com.
41+
</Pillar.Description>
42+
</Pillar>
43+
)
44+
}
45+
46+
export const WithIconColors: StoryFn<typeof Pillar> = () => {
3047
return (
3148
<Grid>
3249
{PillarIconColors.map((color, id) => {

packages/react/src/Pillar/Pillar.module.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
text-align: left;
1616
}
1717

18+
.Pillar__image {
19+
margin-bottom: var(--base-size-28);
20+
border-radius: var(--brand-borderRadius-medium);
21+
overflow: hidden;
22+
}
23+
24+
.Pillar__image img,
25+
.Pillar__image span {
26+
display: block;
27+
}
28+
1829
.Pillar__icon {
1930
display: flex;
2031
margin-bottom: var(--base-size-24);

packages/react/src/Pillar/Pillar.module.css.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ declare const styles: {
22
readonly "Pillar": string;
33
readonly "Pillar--align-center": string;
44
readonly "Pillar--align-start": string;
5+
readonly "Pillar__image": string;
56
readonly "Pillar__icon": string;
67
readonly "Pillar__heading": string;
78
readonly "Pillar__description": string;

0 commit comments

Comments
 (0)