diff --git a/www/apps/book/app/advanced-development/api-routes/parameters/page.mdx b/www/apps/book/app/advanced-development/api-routes/parameters/page.mdx index a3f8cfa049..963dbc01fd 100644 --- a/www/apps/book/app/advanced-development/api-routes/parameters/page.mdx +++ b/www/apps/book/app/advanced-development/api-routes/parameters/page.mdx @@ -16,7 +16,7 @@ export const singlePathHighlights = [ ["11", "req.params.id", "Access the path parameter `id`"] ] -```ts title="src/api/store/hello-world/[id]/route.ts" highlights={singlePathHighlights} apiTesting testApiUrl="http://localhost:9000/store/hello-world/{id}" testApiMethod="GET" testPathParams={{ "id": "1" }} +```ts title="src/api/store/hello-world/[id]/route.ts" highlights={singlePathHighlights} apiTesting testApiUrl="http://localhost:9000/store/hello-world/{id}" testApiMethod="GET" testPathParams={{ "id": "" }} import type { MedusaRequest, MedusaResponse, @@ -45,7 +45,7 @@ export const multiplePathHighlights = [ ["13", "req.params.name", "Access the path parameter `name`"] ] -```ts title="src/api/store/hello-world/[id]/name/[name]/route.ts" highlights={multiplePathHighlights} apiTesting testApiUrl="http://localhost:9000/store/hello-world/{id}/name/{name}" testApiMethod="GET" testPathParams={{ "id": "1", "name": "John" }} +```ts title="src/api/store/hello-world/[id]/name/[name]/route.ts" highlights={multiplePathHighlights} apiTesting testApiUrl="http://localhost:9000/store/hello-world/{id}/name/{name}" testApiMethod="GET" testPathParams={{ "id": "", "name": "" }} import type { MedusaRequest, MedusaResponse, @@ -77,7 +77,7 @@ export const queryHighlights = [ ["11", "req.query.name", "Access the query parameter `name`"], ] -```ts title="src/api/store/hello-world/route.ts" highlights={queryHighlights} apiTesting testApiUrl="http://localhost:9000/store/hello-world" testApiMethod="GET" testQueryParams={{ "name": "John" }} +```ts title="src/api/store/hello-world/route.ts" highlights={queryHighlights} apiTesting testApiUrl="http://localhost:9000/store/hello-world" testApiMethod="GET" testQueryParams={{ "name": "" }} import type { MedusaRequest, MedusaResponse, @@ -130,7 +130,7 @@ In this example, you use the `name` request body parameter to create the message To test it out, send the following request to your Medusa application: -```bash apiTesting testApiUrl="http://localhost:9000/store/hello-world" testApiMethod="POST" testBodyParams={{ "name": "John" }} +```bash apiTesting testApiUrl="http://localhost:9000/store/hello-world" testApiMethod="POST" testBodyParams={{ "name": "" }} curl -X POST 'http://localhost:9000/store/hello-world' \ -H 'Content-Type: application/json' \ --data-raw '{ diff --git a/www/packages/docs-ui/src/components/ApiRunner/FooterBackground/index.tsx b/www/packages/docs-ui/src/components/ApiRunner/FooterBackground/index.tsx new file mode 100644 index 0000000000..f150b36bb8 --- /dev/null +++ b/www/packages/docs-ui/src/components/ApiRunner/FooterBackground/index.tsx @@ -0,0 +1,47 @@ +import React from "react" + +export const ApiRunnerFooterBackground = () => { + return ( + + + + + + + + + + + ) +} diff --git a/www/packages/docs-ui/src/components/ApiRunner/ParamInputs/Default/index.tsx b/www/packages/docs-ui/src/components/ApiRunner/ParamInputs/Default/index.tsx index e4dc92a4de..8dfbffb451 100644 --- a/www/packages/docs-ui/src/components/ApiRunner/ParamInputs/Default/index.tsx +++ b/www/packages/docs-ui/src/components/ApiRunner/ParamInputs/Default/index.tsx @@ -97,6 +97,7 @@ export const ApiRunnerParamInput = ({ ? (paramValue as number) : `${paramValue}` } + className="w-full" /> ) } diff --git a/www/packages/docs-ui/src/components/ApiRunner/ParamInputs/index.tsx b/www/packages/docs-ui/src/components/ApiRunner/ParamInputs/index.tsx index 091cf774c1..164b763bb4 100644 --- a/www/packages/docs-ui/src/components/ApiRunner/ParamInputs/index.tsx +++ b/www/packages/docs-ui/src/components/ApiRunner/ParamInputs/index.tsx @@ -15,11 +15,9 @@ export const ApiRunnerParamInputs = ({ setValue, }: ApiRunnerParamInputsProps) => { return ( -
- - {title} - -
+
+ {title} +
{Object.keys(data).map((pathParam, index) => ( ( }, [isRunning, ran]) return ( -
+
{manualTestTrigger && ( - - {apiTestingOptions.pathData && ( - - > - } - /> +
- > - } - /> - )} - {apiTestingOptions.queryData && ( - - > - } - /> - )} - - + +
+ {apiTestingOptions.pathData && ( + + > + } + /> + )} + {apiTestingOptions.bodyData && ( + + > + } + /> + )} + {apiTestingOptions.queryData && ( + + > + } + /> + )} +
+ +
+
+ + +
+
)} {(isRunning || ran) && ( ( lang="json" title="Testing Result" collapsed={true} - blockStyle="subtle" noReport={true} - badgeLabel={responseCode} + badgeLabel={responseCode || "Failed"} badgeColor={ !responseCode - ? undefined + ? "red" : responseCode.startsWith("2") ? "green" : "red" diff --git a/www/packages/docs-ui/src/components/Button/index.tsx b/www/packages/docs-ui/src/components/Button/index.tsx index 7e5338b685..fef9970efe 100644 --- a/www/packages/docs-ui/src/components/Button/index.tsx +++ b/www/packages/docs-ui/src/components/Button/index.tsx @@ -28,7 +28,7 @@ export const Button = ({ }: ButtonProps) => { const variantClasses = { primary: [ - "px-[10px] py-[6px] rounded-docs_sm cursor-pointer", + "px-docs_0.5 py-docs_0.25 rounded-docs_sm cursor-pointer", "bg-medusa-button-inverted", "hover:bg-medusa-button-inverted-hover hover:no-underline", "active:bg-medusa-button-inverted-pressed", @@ -44,7 +44,7 @@ export const Button = ({ "select-none", ], secondary: [ - "px-[10px] py-[6px] rounded-docs_sm cursor-pointer", + "px-docs_0.5 py-docs_0.25 rounded-docs_sm cursor-pointer", "bg-medusa-button-neutral", "hover:bg-medusa-button-neutral-hover hover:no-underline", "active:bg-medusa-button-neutral-pressed", @@ -58,7 +58,7 @@ export const Button = ({ "select-none", ], transparent: [ - "px-[10px] py-[6px] rounded-docs_sm cursor-pointer", + "px-docs_0.5 py-docs_0.25 rounded-docs_sm cursor-pointer", "bg-transparent shadow-none border-0 outline-none", "text-compact-small-plus text-medusa-fg-base", "hover:bg-medusa-button-transparent-hover", @@ -68,7 +68,7 @@ export const Button = ({ "disabled:cursor-not-allowed disabled:text-medusa-fg-disabled", ], transparentClear: [ - "px-[10px] py-[6px] rounded-docs_sm cursor-pointer", + "px-docs_0.5 py-docs_0.25 rounded-docs_sm cursor-pointer", "bg-transparent shadow-none border-0 outline-none", "text-compact-small-plus text-medusa-fg-muted", "hover:bg-medusa-button-transparent-hover", @@ -82,7 +82,7 @@ export const Button = ({ return (