Skip to content

Commit 61218e7

Browse files
davejcameronlizkenyon
authored andcommitted
Update components and types
1 parent fa110d3 commit 61218e7

File tree

6 files changed

+17
-29
lines changed

6 files changed

+17
-29
lines changed

sample-apps/delivery-customizations/app/routes/app._index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,8 @@ export default function Index() {
104104
const generateProduct = () => fetcher.submit({}, { method: "POST" });
105105

106106
return (
107-
<s-page>
108-
<TitleBar title="React Router app template">
109-
<button variant="primary" onClick={generateProduct}>
110-
Generate a product
111-
</button>
112-
</TitleBar>
107+
<s-page heading="React Router app template">
108+
<s-button variant="primary" onClick={generateProduct} slot="primary-action">Generate a product</s-button>
113109
<s-section heading="Congrats on creating a new Shopify app 🎉">
114110
<s-paragraph>
115111
This embedded app template uses{" "}

sample-apps/delivery-customizations/app/routes/app.additional.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { TitleBar } from "@shopify/app-bridge-react";
22

33
export default function AdditionalPage() {
44
return (
5-
<s-page>
6-
<TitleBar title="Additional page"></TitleBar>
5+
<s-page heading="Additional page">
76
<s-section heading="Multiple pages">
87
<s-paragraph>
98
The app template comes with an additional page which demonstrates how
@@ -19,7 +18,7 @@ export default function AdditionalPage() {
1918
<s-paragraph>
2019
To create your own page and have it show up in the app navigation, add
2120
a page inside <code>app/routes</code>, and a link to it in the{" "}
22-
<code>&lt;NavMenu&gt;</code> component found in{" "}
21+
<code>&lt;s-app-nav&gt;</code> component found in{" "}
2322
<code>app/routes/app.jsx</code>.
2423
</s-paragraph>
2524
</s-section>

sample-apps/delivery-customizations/app/routes/app.delivery-customization.$functionId.$id.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ export default function DeliveryCustomization() {
155155
const navigation = useNavigation();
156156
const loaderData = useLoaderData<LoaderData>();
157157

158-
const parsedLoaderData: DeliveryCustomizationData = loaderData?.body
159-
? JSON.parse(loaderData.body)
158+
const parsedLoaderData: DeliveryCustomizationData = loaderData?.body
159+
? JSON.parse(loaderData.body)
160160
: { stateProvinceCode: "", message: "" };
161-
161+
162162
const [stateProvinceCode, setStateProvinceCode] = useState(parsedLoaderData.stateProvinceCode);
163163
const [message, setMessage] = useState(parsedLoaderData.message);
164164

@@ -200,20 +200,15 @@ const handleReset = () => {
200200

201201
return (
202202
<form data-save-bar onSubmit={handleSubmit} onReset={handleReset}>
203-
<s-page>
204-
<ui-title-bar title="Change delivery message">
205-
<button variant="breadcrumb" href="shopify:admin/settings/shipping/customizations">
206-
Delivery customizations
207-
</button>
208-
</ui-title-bar>
203+
<s-page heading="Change delivery message">
204+
<s-link slot="breadcrumb-actions" href="shopify:admin/settings/shipping/customizations">Delivery customizations</s-link>
209205

210206
{errorBanner}
211207

212208
<s-section>
213-
<s-grid gap="base">
209+
<s-grid gap="base" gridTemplateColumns="1fr 1fr">
214210
<s-text-field
215211
name="stateProvinceCode"
216-
type="text"
217212
label="State/Province code"
218213
value={stateProvinceCode}
219214
required
@@ -223,7 +218,6 @@ return (
223218

224219
<s-text-field
225220
name="message"
226-
type="text"
227221
label="Message"
228222
value={message}
229223
required
@@ -235,4 +229,4 @@ return (
235229
</s-page>
236230
</form>
237231
);
238-
}
232+
}

sample-apps/delivery-customizations/app/routes/app.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ export default function App() {
1717

1818
return (
1919
<AppProvider embedded apiKey={apiKey}>
20-
<NavMenu>
21-
<Link to="/app" rel="home">
22-
Home
23-
</Link>
24-
<Link to="/app/additional">Additional page</Link>
25-
</NavMenu>
20+
<s-app-nav>
21+
<s-link href="/app" rel="home">Home</s-link>
22+
<s-link href="/app/additional">Additional page</s-link>
23+
</s-app-nav>
2624
<Outlet />
2725
</AppProvider>
2826
);

sample-apps/delivery-customizations/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
},
4343
"devDependencies": {
4444
"@shopify/api-codegen-preset": "^1.1.1",
45+
"@shopify/polaris-types": "^1.0.1",
4546
"@types/eslint": "^9.6.1",
4647
"@types/node": "^22.2.0",
4748
"@types/react": "^18.2.31",

sample-apps/delivery-customizations/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"moduleResolution": "Bundler",
1717
"target": "ES2022",
1818
"baseUrl": ".",
19-
"types": ["@react-router/node", "vite/client"],
19+
"types": ["@react-router/node", "vite/client", "@shopify/polaris-types"],
2020
"rootDirs": [".", "./.react-router/types"]
2121
}
2222
}

0 commit comments

Comments
 (0)