Skip to content

Commit 2c9bea2

Browse files
Merge pull request #2716 from Shopify/add-docs-for-the-new-target
add docs for customer-account.footer.render-after target
2 parents 40f693c + 86e45e8 commit 2c9bea2

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {
2+
BlockStack,
3+
Text,
4+
extension,
5+
} from '@shopify/ui-extensions/customer-account';
6+
7+
export default extension(
8+
'customer-account.footer.render-after',
9+
(root, {extension}) => {
10+
root.appendChild(
11+
root.createComponent(
12+
BlockStack,
13+
undefined,
14+
root.createComponent(
15+
Text,
16+
undefined,
17+
`target: ${extension.target}`,
18+
),
19+
),
20+
);
21+
},
22+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {
2+
BlockStack,
3+
reactExtension,
4+
Text,
5+
useApi,
6+
} from '@shopify/ui-extensions-react/customer-account';
7+
8+
// 1. Choose an extension target
9+
export default reactExtension(
10+
'customer-account.footer.render-after',
11+
() => <Extension />,
12+
);
13+
14+
function Extension() {
15+
// 2. Use the extension API to gather context from extension
16+
const {extension} = useApi();
17+
18+
// 3. Render a UI
19+
return (
20+
<BlockStack>
21+
<Text>target: {extension.target}</Text>
22+
</BlockStack>
23+
);
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import type {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
2+
3+
import {CUSTOMER_ACCOUNT_STANDARD_API_DEFINITION} from '../helper.docs';
4+
5+
const data: ReferenceEntityTemplateSchema = {
6+
name: 'customer-account.footer.render-after',
7+
description: `A [static extension target](/docs/api/customer-account-ui-extensions/extension-targets-overview#static-extension-targets) that is rendered below \
8+
the footer on all customer account pages (**Order index**, **Order status**, **Profile**, **Settings** and new pages added by [Full-page extensions](/docs/api/customer-account-ui-extensions/extension-targets-overview#full-page-extension-target)).
9+
10+
> Tip:
11+
> To prevent layout shifting, avoid dynamic data fetching & rendering in this target. If you need to render dynamic content, consider reserving space for your content while it is loading.
12+
> See: [Spinner](/docs/api/checkout-ui-extensions/components/feedback/spinner), [SkeletonText](/docs/api/checkout-ui-extensions/components/feedback/skeletontext), or [BlockSpacer](/docs/api/checkout-ui-extensions/components/structure/blockspacer).
13+
`,
14+
category: 'Targets',
15+
isVisualComponent: false,
16+
subCategory: 'Footer',
17+
defaultExample: {
18+
description: '',
19+
codeblock: {
20+
title: 'Customer account footer extension example',
21+
tabs: [
22+
{
23+
code: '../examples/targets/customer-account.footer.render-after/default.example.tsx',
24+
language: 'jsx',
25+
title: 'React',
26+
},
27+
{
28+
code: '../examples/targets/customer-account.footer.render-after/default.example.ts',
29+
language: 'js',
30+
title: 'Javascript',
31+
},
32+
],
33+
},
34+
},
35+
definitions: [CUSTOMER_ACCOUNT_STANDARD_API_DEFINITION],
36+
related: [],
37+
type: 'Target',
38+
};
39+
40+
export default data;

0 commit comments

Comments
 (0)