Skip to content

Commit

Permalink
Merge pull request #1338 from Shopify/page-component
Browse files Browse the repository at this point in the history
Add Page component
  • Loading branch information
oleksandroliynyk authored Sep 28, 2023
2 parents b11900c + 22eb0ed commit 0fae958
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 0 deletions.
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'],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export {Page} from './Page';
export type {PageProps} from './Page';
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';
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');
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export {Page} from './Page';
export type {PageProps} from './Page';
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';

0 comments on commit 0fae958

Please sign in to comment.