-
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.
Merge pull request #1338 from Shopify/page-component
Add Page component
- Loading branch information
Showing
6 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
packages/ui-extensions-react/src/surfaces/customer-account/components/Page/Page.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,11 @@ | ||
import {Page as BasePage} from '@shopify/ui-extensions/customer-account'; | ||
import { | ||
createRemoteReactComponent, | ||
ReactPropsFromRemoteComponentType, | ||
} from '@remote-ui/react'; | ||
|
||
export type PageProps = ReactPropsFromRemoteComponentType<typeof BasePage>; | ||
|
||
export const Page = createRemoteReactComponent(BasePage, { | ||
fragmentProps: ['primaryAction', 'secondaryAction'], | ||
}); |
2 changes: 2 additions & 0 deletions
2
packages/ui-extensions-react/src/surfaces/customer-account/components/Page/index.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,2 @@ | ||
export {Page} from './Page'; | ||
export type {PageProps} from './Page'; |
1 change: 1 addition & 0 deletions
1
packages/ui-extensions-react/src/surfaces/customer-account/components/index.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './Card'; | ||
export * from './CustomerAccountAction'; | ||
export * from './Page'; | ||
export * from './PolicyModal'; | ||
export * from './shared-checkout-components'; |
49 changes: 49 additions & 0 deletions
49
packages/ui-extensions/src/surfaces/customer-account/components/Page/Page.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,49 @@ | ||
import {createRemoteComponent} from '@remote-ui/core'; | ||
import type {RemoteFragment} from '@remote-ui/core'; | ||
|
||
export interface PageProps { | ||
/** | ||
* The text to be used as title. | ||
*/ | ||
title: string; | ||
|
||
/** | ||
* The text to be used as subtitle. | ||
*/ | ||
subtitle?: string; | ||
|
||
/** | ||
* The action grouping, provided as button(s), that is placed in the primary position of the page. | ||
*/ | ||
primaryAction?: RemoteFragment; | ||
|
||
/** | ||
* Label for the primary action grouping. | ||
* | ||
* @defaultValue "More actions" | ||
*/ | ||
primaryActionLabel?: string; | ||
|
||
/** | ||
* Accessibility label for the primary action grouping. | ||
* | ||
* @defaultValue "More actions" | ||
*/ | ||
primaryActionAccessibilityLabel?: string; | ||
|
||
/** | ||
* The secondary action provided as a button, that is placed in the secondary position of the page. | ||
*/ | ||
secondaryAction?: RemoteFragment; | ||
|
||
/** | ||
* Indicates that the page is in a loading state. | ||
* | ||
* When `true`, the page will be replaced by loading indicators (for example: skeletons or spinners). | ||
* | ||
* @defaultValue false | ||
*/ | ||
loading?: boolean; | ||
} | ||
|
||
export const Page = createRemoteComponent<'Page', PageProps>('Page'); |
2 changes: 2 additions & 0 deletions
2
packages/ui-extensions/src/surfaces/customer-account/components/Page/index.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,2 @@ | ||
export {Page} from './Page'; | ||
export type {PageProps} from './Page'; |
1 change: 1 addition & 0 deletions
1
packages/ui-extensions/src/surfaces/customer-account/components/index.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './Card'; | ||
export * from './CustomerAccountAction'; | ||
export * from './Page'; | ||
export * from './PolicyModal'; | ||
export * from './shared-checkout-components'; |