-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Elana Kopelevich
authored and
Elana Kopelevich
committed
May 30, 2024
1 parent
4ae74df
commit 9713a50
Showing
7 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
packages/ui-extensions-react/src/surfaces/admin/components.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...es/ui-extensions-react/src/surfaces/admin/components/AdminPrintAction/AdminPrintAction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {AdminPrintAction as BaseAdminPrintAction} from '@shopify/ui-extensions/admin'; | ||
import { | ||
createRemoteReactComponent, | ||
ReactPropsFromRemoteComponentType, | ||
} from '@remote-ui/react'; | ||
|
||
export const AdminPrintAction = | ||
createRemoteReactComponent(BaseAdminPrintAction); | ||
|
||
export type AdminPrintActionProps = ReactPropsFromRemoteComponentType< | ||
typeof BaseAdminPrintAction | ||
>; |
18 changes: 18 additions & 0 deletions
18
...rc/surfaces/admin/components/AdminPrintAction/examples/basic-adminprintaction.example.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import { | ||
reactExtension, | ||
AdminAction, | ||
} from '@shopify/ui-extensions-react/admin'; | ||
|
||
function App() { | ||
return ( | ||
<AdminAction src="https://example.com"> | ||
Modal content | ||
</AdminAction> | ||
); | ||
} | ||
|
||
export default reactExtension( | ||
'Playground', | ||
() => <App />, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ages/ui-extensions/src/surfaces/admin/components/AdminPrintAction/AdminPrintAction.doc.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'; | ||
|
||
const data: ReferenceEntityTemplateSchema = { | ||
name: 'AdminPrintAction', | ||
description: | ||
'AdminPrintAction is a component used by Admin print action extensions to configure a src. Admin print action extensions require the use of this component.', | ||
requires: '', | ||
thumbnail: 'AdminPrintAction-thumbnail.png', | ||
isVisualComponent: true, | ||
type: '', | ||
definitions: [ | ||
{ | ||
title: 'AdminPrintActionProps', | ||
description: '', | ||
type: 'AdminPrintActionProps', | ||
}, | ||
], | ||
category: 'Components', | ||
subCategory: 'Other', | ||
defaultExample: { | ||
image: 'AdminPrintAction-default.png', | ||
codeblock: { | ||
title: 'Set the source URL of the print action extension.', | ||
tabs: [ | ||
{ | ||
title: 'React', | ||
code: '../../../../../../ui-extensions-react/src/surfaces/admin/components/AdminPrintAction/examples/basic-AdminPrintAction.example.tsx', | ||
language: 'tsx', | ||
}, | ||
{ | ||
title: 'JS', | ||
code: './examples/basic-AdminPrintAction.example.ts', | ||
language: 'js', | ||
}, | ||
], | ||
}, | ||
}, | ||
related: [ | ||
{ | ||
type: 'component', | ||
name: 'AdminAction', | ||
url: '/docs/api/admin-extensions/components/other/adminaction', | ||
}, | ||
{ | ||
type: 'component', | ||
name: 'AdminBlock', | ||
url: '/docs/api/admin-extensions/components/other/adminblock', | ||
}, | ||
], | ||
}; | ||
|
||
export default data; |
17 changes: 17 additions & 0 deletions
17
packages/ui-extensions/src/surfaces/admin/components/AdminPrintAction/AdminPrintAction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {createRemoteComponent} from '@remote-ui/core'; | ||
|
||
export interface AdminPrintActionProps { | ||
/** | ||
* Sets the src URL of the preview and the document to print. | ||
* If not provided, the preview will show an empty state and the print button will be disabled. | ||
*/ | ||
src?: string; | ||
} | ||
|
||
/** | ||
* AdminPrintAction is a component used by Admin Print Action extensions to configure a src document to preview and print. | ||
*/ | ||
export const AdminPrintAction = createRemoteComponent< | ||
'AdminPrintAction', | ||
AdminPrintActionProps | ||
>('AdminPrintAction'); |
10 changes: 10 additions & 0 deletions
10
...src/surfaces/admin/components/AdminPrintAction/examples/basic-adminprintaction.example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {extension, AdminPrintAction} from '@shopify/ui-extensions/admin'; | ||
|
||
export default extension('Playground', (root) => { | ||
const adminPrintAction = root.createComponent(AdminPrintAction, { | ||
src: 'https://example.com', | ||
}, 'Modal content'); | ||
|
||
root.appendChild(adminPrintAction); | ||
root.mount(); | ||
}); |