Skip to content

Commit ab0cf25

Browse files
chazdeanlaurkim
andauthored
[Layout foundations] Update AlphaCard component docs and guidance (#7568)
<!-- ☝️How to write a good PR title: - Prefix it with [ComponentName] (if applicable), for example: [Button] - Start with a verb, for example: Add, Delete, Improve, Fix… - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ### WHY are these changes introduced? Fixes #6905 <!-- link to issue if one exists --> <!-- Context about the problem that’s being addressed. --> ### WHAT is this pull request doing? Updates the `AlphaCard` component docs and guidance <details> <summary>AlphaCard style guide</summary> <img src="https://user-images.githubusercontent.com/59836805/198679436-320894fa-017d-4a0c-bb14-3fd8b1cc4c77.gif" alt="AlphaCard styleguide" width="600"> </details> <!-- Summary of the changes committed. Before / after screenshots are appreciated for UI changes. Make sure to include alt text that describes the screenshot. If you include an animated gif showing your change, wrapping it in a details tag is recommended. Gifs usually autoplay, which can cause accessibility issues for people reviewing your PR: <details> <summary>Summary of your gif(s)</summary> <img src="..." alt="Description of what the gif shows"> </details> --> <!-- ℹ️ Delete the following for small / trivial changes --> ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [ ] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [ ] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide Co-authored-by: Lo Kim <[email protected]>
1 parent 8859f5d commit ab0cf25

File tree

8 files changed

+105
-60
lines changed

8 files changed

+105
-60
lines changed

.changeset/five-bats-attend.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'polaris.shopify.com': patch
3+
---
4+
5+
Updated `AlphaCard` component guidance and examples

polaris.shopify.com/content/components/alpha-card.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Alpha card
3-
description: Cards are used to group similar concepts and tasks together to make Shopify easier for merchants to scan, read, and get things done.
3+
description: Cards are used to group similar concepts and tasks together for merchants to scan, read, and get things done. It displays content in a familiar and recognizable style.
44
category: Structure
55
keywords:
66
- layout
@@ -26,10 +26,23 @@ status:
2626
examples:
2727
- fileName: alpha-card-default.tsx
2828
title: Default
29-
- fileName: alpha-card-subdued.tsx
30-
title: With subdued for secondary content
31-
description: Use for content that you want to deprioritize. Subdued cards don’t stand out as much as cards with white backgrounds so don’t use them for information or actions that are critical to merchants.
32-
- fileName: alpha-card-without-border-radius.tsx
33-
title: Without border radius
34-
description: Border radius can be toggled to display only past a certain breakpoint.
29+
- fileName: alpha-card-with-subdued-background.tsx
30+
title: With subdued background
31+
description: >-
32+
Use for content that you want to deprioritize. Subdued cards don’t stand out as much as cards with white backgrounds so don’t use them for information or actions that are critical to merchants.
33+
- fileName: alpha-card-with-varying-padding.tsx
34+
title: With varying padding
35+
description: >-
36+
Use the `padding` property to adjust the spacing within a card. You can also specify spacing values at different breakpoints.
37+
- fileName: alpha-card-with-rounded-corners.tsx
38+
title: Rounded corners
39+
description: >-
40+
Cards have an 8px border radius by default. Rounding may also be applied responsively with the roundedAbove prop. This enables cards to be softened on larger screens, but squared off when they are full bleed on smaller devices.
3541
---
42+
43+
## Best practices
44+
45+
Cards should:
46+
47+
- Group related information
48+
- Display information in a way that prioritizes what the merchant needs to know most first

polaris.shopify.com/pages/examples/alpha-card-default.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
import {AlphaCard, Text, AlphaStack} from '@shopify/polaris';
1+
import {AlphaCard, Text} from '@shopify/polaris';
22
import React from 'react';
33
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
44

55
function AlphaCardExample() {
66
return (
77
<AlphaCard>
8-
<AlphaStack spacing="5">
9-
<Text as="h3" variant="headingMd">
10-
Online store dashboard
11-
</Text>
12-
<p>View a summary of your online store’s performance.</p>
13-
</AlphaStack>
8+
<Text as="h2" variant="bodyMd">
9+
Content inside a card
10+
</Text>
1411
</AlphaCard>
1512
);
1613
}

polaris.shopify.com/pages/examples/alpha-card-subdued.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {AlphaCard, Text} from '@shopify/polaris';
2+
import React from 'react';
3+
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
4+
5+
function AlphaCardExample() {
6+
return (
7+
<AlphaCard roundedAbove="md">
8+
<Text as="h2" variant="bodyMd">
9+
Content inside a card
10+
</Text>
11+
</AlphaCard>
12+
);
13+
}
14+
15+
export default withPolarisExample(AlphaCardExample);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {AlphaCard, Text} from '@shopify/polaris';
2+
import React from 'react';
3+
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
4+
5+
function AlphaCardExample() {
6+
return (
7+
<AlphaCard background="surface-subdued">
8+
<Text as="h2" variant="bodyMd">
9+
Content inside a card
10+
</Text>
11+
</AlphaCard>
12+
);
13+
}
14+
15+
export default withPolarisExample(AlphaCardExample);
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import {AlphaCard, Text, AlphaStack} from '@shopify/polaris';
2+
import React from 'react';
3+
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
4+
5+
function AlphaCardExample() {
6+
return (
7+
<AlphaStack spacing="4" fullWidth>
8+
<AlphaCard>
9+
<Placeholder label="Content inside a card" />
10+
</AlphaCard>
11+
<AlphaCard padding="4">
12+
<Placeholder label="Content inside a card" />
13+
</AlphaCard>
14+
<AlphaCard padding="2">
15+
<Placeholder label="Content inside a card" />
16+
</AlphaCard>
17+
<AlphaCard padding="0">
18+
<Placeholder label="Content inside a card" />
19+
</AlphaCard>
20+
</AlphaStack>
21+
);
22+
}
23+
24+
const Placeholder = ({label = '', height = 'auto', width = 'auto'}) => {
25+
return (
26+
<div
27+
style={{
28+
background: '#7B47F1',
29+
height: height,
30+
width: width,
31+
}}
32+
>
33+
<div
34+
style={{
35+
color: '#FFFFFF',
36+
}}
37+
>
38+
<Text as="h2" variant="bodyMd">
39+
{label}
40+
</Text>
41+
</div>
42+
</div>
43+
);
44+
};
45+
46+
export default withPolarisExample(AlphaCardExample);

polaris.shopify.com/pages/examples/alpha-card-without-border-radius.tsx

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)