Skip to content

Commit f4585b2

Browse files
committed
Add documentation and example for Admin Modal component
1 parent 384f59e commit f4585b2

File tree

6 files changed

+62
-1
lines changed

6 files changed

+62
-1
lines changed

.changeset/small-roses-double.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': patch
3+
---
4+
5+
Add documentation for Admin Modal
23.2 KB
Loading

packages/ui-extensions/src/docs/shared/components/Modal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const data: SharedReferenceEntityTemplateSchema = {
55
description:
66
'Use modal to display content in a overlay. This component is useful for creating a distraction-free experience, such as a confirmation dialog or a settings panel.',
77
category: 'Polaris web components',
8-
subCategory: 'Overlay',
8+
subCategory: 'Overlays',
99
related: [],
1010
};
1111

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import {AdminReferenceEntityTemplateSchema} from '../../docs-types';
2+
import sharedContent from '../../../../docs/shared/components/Modal';
3+
4+
const data: AdminReferenceEntityTemplateSchema = {
5+
...sharedContent,
6+
thumbnail: '/assets/templated-apis-screenshots/admin/components/modal.png',
7+
isVisualComponent: true,
8+
definitions: [
9+
{
10+
title: 'Properties',
11+
description: '',
12+
type: 'Modal',
13+
},
14+
{
15+
title: 'Events',
16+
description:
17+
'Learn more about [registering events](/docs/api/app-home/using-polaris-components#event-handling).',
18+
type: 'ModalEvents',
19+
},
20+
{
21+
title: 'Slots',
22+
description: '',
23+
type: 'ModalSlots',
24+
},
25+
],
26+
defaultExample: {
27+
codeblock: {
28+
title: 'Code',
29+
tabs: [
30+
{
31+
code: './examples/default.html',
32+
language: 'preview',
33+
layout: 'alignStart',
34+
},
35+
],
36+
},
37+
},
38+
};
39+
40+
export default data;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<s-button commandFor="modal">Open</s-button>
2+
3+
<s-modal id="modal" heading="Reach more shoppers with Instagram product tags">
4+
<s-paragraph>
5+
Use Instagram posts to share your products with millions of people.
6+
Let shoppers buy from your store without leaving Instagram.
7+
</s-paragraph>
8+
9+
<s-button slot="secondary-actions" commandFor="modal" command="--hide">
10+
Learn more
11+
</s-button>
12+
<s-button slot="primary-action" variant="primary" commandFor="modal" command="--hide">
13+
Add Instagram
14+
</s-button>
15+
</s-modal>

packages/ui-extensions/src/surfaces/admin/components/StandardComponents.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export type StandardComponents =
2323
| 'Link'
2424
| 'ListItem'
2525
| 'Menu'
26+
| 'Modal'
2627
| 'MoneyField'
2728
| 'NumberField'
2829
| 'Option'

0 commit comments

Comments
 (0)