diff --git a/.changeset/mighty-eels-live.md b/.changeset/mighty-eels-live.md new file mode 100644 index 0000000..7bf80c2 --- /dev/null +++ b/.changeset/mighty-eels-live.md @@ -0,0 +1,5 @@ +--- +"@saleor/apps-ui": minor +--- + +Added TextLink component that can work with Next router and AppBridge.dispatch diff --git a/.changeset/quick-rules-doubt.md b/.changeset/quick-rules-doubt.md new file mode 100644 index 0000000..eafcfe2 --- /dev/null +++ b/.changeset/quick-rules-doubt.md @@ -0,0 +1,5 @@ +--- +"saleor-app-search": minor +--- + +Use TextLink component from shared package diff --git a/apps/search/next.config.js b/apps/search/next.config.js index 8d3ee7d..4f637e1 100644 --- a/apps/search/next.config.js +++ b/apps/search/next.config.js @@ -23,7 +23,7 @@ const moduleExports = { }, ], }, - transpilePackages: ["@saleor/apps-shared"], + transpilePackages: ["@saleor/apps-shared", "@saleor/apps-ui"], sentry: { /* * Use `hidden-source-map` rather than `source-map` as the Webpack `devtool` diff --git a/apps/search/src/components/MainInstructions.tsx b/apps/search/src/components/MainInstructions.tsx index 42898f7..5610ca8 100644 --- a/apps/search/src/components/MainInstructions.tsx +++ b/apps/search/src/components/MainInstructions.tsx @@ -1,12 +1,10 @@ -import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge"; +import { TextLink } from "@saleor/apps-ui"; import { Box, PropsWithBox, Text } from "@saleor/macaw-ui/next"; const SALEOR_EVENTS_DOCS_URL = "https://docs.saleor.io/docs/3.x/developer/extending/apps/asynchronous-webhooks#available-webhook-events"; export const MainInstructions = ({ children, ...props }: PropsWithBox<{}>) => { - const { appBridge } = useAppBridge(); - return ( @@ -17,25 +15,10 @@ export const MainInstructions = ({ children, ...props }: PropsWithBox<{}>) => { Saleor database. - The app supports following{" "} - { - e.preventDefault(); - - /** - * TODO extract shared handler - */ - appBridge?.dispatch( - actions.Redirect({ - to: SALEOR_EVENTS_DOCS_URL, - newContext: true, - }) - ); - }} - href={SALEOR_EVENTS_DOCS_URL} - > + The app supports following + events - {" "} + that will synchronize Algolia in the background: