Skip to content

Commit c00769a

Browse files
paulstairmandkaelig
authored andcommitted
Add mobile guidelines to card component (#1784)
1 parent 1124bf3 commit c00769a

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [these versioning and changelog guidelines][changelog-gui
66

77
## Unreleased
88

9+
## Documentation
10+
11+
- Added iOS and Android examples for the card component ([#1784](https://github.com/Shopify/polaris-react/pull/1784))
12+
913
### Bug fixes
1014

1115
- Remove stickyManager from app provider props interface ([#1706](https://github.com/Shopify/polaris-react/pull/1706))

src/components/Card/README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
name: Card
33
category: Structure
4+
platforms:
5+
- android
6+
- ios
7+
- web
48
keywords:
59
- layout
610
- container
@@ -200,10 +204,26 @@ Use when you have a simple message to communicate to merchants that doesn’t re
200204
</Card>
201205
```
202206

207+
<!-- content-for: android -->
208+
209+
![Default card with a title and a short body](components/Card/android/default.png)
210+
211+
<!-- /content-for -->
212+
213+
<!-- content-for: ios -->
214+
215+
![Default card with a title and a short body](components/Card/ios/default.png)
216+
217+
<!-- /content-for -->
218+
203219
### Card with header actions
204220

221+
<!-- content-for: web -->
222+
205223
Use for less important card actions, or actions the merchant may do before reviewing the contents of the card. For example, a merchant may want to add items to a card containing a long list, or enter a customer’s new address.
206224

225+
<!-- /content-for -->
226+
207227
```jsx
208228
<Card sectioned title="Variants" actions={[{content: 'Add variant'}]}>
209229
<p>
@@ -213,10 +233,35 @@ Use for less important card actions, or actions the merchant may do before revie
213233
</Card>
214234
```
215235

236+
<!-- content-for: ios, android -->
237+
238+
Use for less important card actions, or actions the merchant may do before reviewing the contents of the card.
239+
240+
- Use an icon for the action, if possible
241+
- Include no more than 2 actions
242+
243+
<!-- /content-for -->
244+
245+
<!-- content-for: android -->
246+
247+
![Card with a title (Conditions), a short body and a header action to add a condition](components/Card/android/header-actions.png)
248+
249+
<!-- /content-for -->
250+
251+
<!-- content-for: ios -->
252+
253+
![Card with a title (Conditions), a short body and a header action to add a condition](components/Card/ios/header-actions.png)
254+
255+
<!-- /content-for -->
256+
216257
### Card with footer actions
217258

259+
<!-- content-for: web -->
260+
218261
Use footer actions for a card’s most important actions, or actions merchants should do after reviewing the contents of the card. For example, a merchant should review the contents of a shipment before important actions like cancelling or adding tracking information.
219262

263+
<!-- /content-for -->
264+
220265
```jsx
221266
<Card
222267
title="Shipment 1234"
@@ -232,6 +277,27 @@ Use footer actions for a card’s most important actions, or actions merchants s
232277
</Card>
233278
```
234279

280+
<!-- content-for: android, ios -->
281+
282+
Use footer actions for a card’s most important actions, or actions merchants should do after reviewing the contents of the card.
283+
284+
- Use buttons with labels
285+
- If you have more than 2 actions, consider using an overflow menu on the card
286+
287+
<!-- /content-for -->
288+
289+
<!-- content-for: android -->
290+
291+
![Card featuring footer actions: add variant, edit options](components/Card/android/footer-actions.png)
292+
293+
<!-- /content-for -->
294+
295+
<!-- content-for: ios -->
296+
297+
![Card featuring footer actions: add variant, edit options](components/Card/ios/footer-actions.png)
298+
299+
<!-- /content-for -->
300+
235301
### Card with multiple sections
236302

237303
Use when you have two related but distinct pieces of information to communicate to merchants. Multiple sections can help break up complicated concepts to make them easier to scan and understand.
@@ -251,6 +317,18 @@ Use when you have two related but distinct pieces of information to communicate
251317
</Card>
252318
```
253319

320+
<!-- content-for: android -->
321+
322+
![Shipping costs card with multiple sections: domestic, international](components/Card/android/multiple-sections.png)
323+
324+
<!-- /content-for -->
325+
326+
<!-- content-for: ios -->
327+
328+
![Shipping costs card with multiple sections: domestic, international](components/Card/ios/multiple-sections.png)
329+
330+
<!-- /content-for -->
331+
254332
### Card with multiple titled sections
255333

256334
Use when you have two related but distinct pieces of information to communicate to merchants that are complex enough to require a title to introduce them.
@@ -270,8 +348,22 @@ Use when you have two related but distinct pieces of information to communicate
270348
</Card>
271349
```
272350

351+
<!-- content-for: android -->
352+
353+
![Customer card with multiple titled sections: note, shipping address](components/Card/android/multiple-titled-sections.png)
354+
355+
<!-- /content-for -->
356+
357+
<!-- content-for: ios -->
358+
359+
![Customer card with multiple titled sections: note, shipping address](components/Card/ios/multiple-titled-sections.png)
360+
361+
<!-- /content-for -->
362+
273363
### Card with a subdued section
274364

365+
<!-- example-for: web -->
366+
275367
Use to indicate when one of the sections in your card contains inactive or disabled content.
276368

277369
```jsx
@@ -294,6 +386,8 @@ Use to indicate when one of the sections in your card contains inactive or disab
294386

295387
### Subdued card for secondary content
296388

389+
<!-- example-for: web -->
390+
297391
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.
298392

299393
```jsx

0 commit comments

Comments
 (0)