Skip to content

Commit 4744ee0

Browse files
committed
Update AlphaCard docs
1 parent a9051d6 commit 4744ee0

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+
Update `AlphaCard` component docs

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 ?? undefined,
30+
width: width ?? undefined,
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)