From c38f6d07c21fcb1e76347c85a0535b2fc7b9c77d Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 4 Jun 2024 10:41:24 +0300 Subject: [PATCH] docs: update design + colors (#7593) Update design and colors in docs to match those in Figma --- www/apps/api-reference/app/globals.css | 2 +- .../CodeSection/RequestSamples/index.tsx | 25 +- .../ui/src/components/package-install.tsx | 23 +- www/apps/ui/src/providers/search.tsx | 7 +- www/apps/ui/src/styles/globals.css | 2 +- .../AiAssistant/CommandIcon/index.tsx | 24 - .../AiAssistant/ThreadItem/Actions/index.tsx | 2 +- .../src/components/AiAssistant/index.tsx | 8 +- .../docs-ui/src/components/Badge/index.tsx | 30 +- .../docs-ui/src/components/Button/index.tsx | 72 +-- .../docs-ui/src/components/Card/index.tsx | 7 +- .../CodeBlock/Actions/Copy/index.tsx | 42 ++ .../components/CodeBlock/Actions/index.tsx | 109 +++++ .../src/components/CodeBlock/Header/index.tsx | 79 ++-- .../src/components/CodeBlock/Line/index.tsx | 10 +- .../src/components/CodeBlock/index.tsx | 309 ++++++------ .../src/components/CodeTabs/Item/index.tsx | 24 +- .../docs-ui/src/components/CodeTabs/index.tsx | 90 ++-- .../components/Icons/AiAssistant/index.tsx | 442 ++++++++++++++++++ .../src/components/Icons/ShadedBg/index.tsx | 248 ++++++++++ .../docs-ui/src/components/Icons/index.tsx | 2 + .../src/components/Input/Text/index.tsx | 2 +- .../docs-ui/src/components/Kbd/index.tsx | 6 +- .../components/LearningPath/Icon/index.tsx | 2 +- .../components/LearningPath/Steps/index.tsx | 4 +- .../src/components/LearningPath/index.tsx | 2 +- .../src/components/LegacyCodeTabs/index.tsx | 172 ------- .../src/components/Modal/Header/index.tsx | 2 +- .../docs-ui/src/components/Modal/index.tsx | 2 +- .../components/Navbar/MobileMenu/index.tsx | 8 +- .../src/components/Note/Layout/index.tsx | 15 +- .../Item/Layout/Default/index.tsx | 2 +- .../src/components/Npm2YarnCode/index.tsx | 72 +-- .../docs-ui/src/components/Rating/index.tsx | 2 +- .../components/Search/ModalOpener/index.tsx | 2 +- .../components/Search/Suggestions/index.tsx | 8 +- .../docs-ui/src/components/Search/index.tsx | 2 +- .../src/components/Select/Dropdown/index.tsx | 2 +- .../src/components/Sidebar/Item/index.tsx | 13 +- .../docs-ui/src/components/TextArea/index.tsx | 2 +- .../docs-ui/src/components/Tooltip/index.tsx | 10 +- .../docs-ui/src/components/TypeList/index.tsx | 2 +- www/packages/docs-ui/src/components/index.ts | 2 - www/packages/tailwind/base.tailwind.config.js | 188 ++++---- www/packages/tailwind/theme-presets.js | 236 +++++----- 45 files changed, 1511 insertions(+), 804 deletions(-) delete mode 100644 www/packages/docs-ui/src/components/AiAssistant/CommandIcon/index.tsx create mode 100644 www/packages/docs-ui/src/components/CodeBlock/Actions/Copy/index.tsx create mode 100644 www/packages/docs-ui/src/components/CodeBlock/Actions/index.tsx create mode 100644 www/packages/docs-ui/src/components/Icons/AiAssistant/index.tsx create mode 100644 www/packages/docs-ui/src/components/Icons/ShadedBg/index.tsx delete mode 100644 www/packages/docs-ui/src/components/LegacyCodeTabs/index.tsx diff --git a/www/apps/api-reference/app/globals.css b/www/apps/api-reference/app/globals.css index 88cbdb7db1..197a81cac6 100644 --- a/www/apps/api-reference/app/globals.css +++ b/www/apps/api-reference/app/globals.css @@ -44,7 +44,7 @@ } pre *::selection { - @apply !bg-medusa-code-text-highlight; + @apply !bg-medusa-contrast-bg-highlight; } body[data-modal="opened"] { diff --git a/www/apps/api-reference/components/Tags/Operation/CodeSection/RequestSamples/index.tsx b/www/apps/api-reference/components/Tags/Operation/CodeSection/RequestSamples/index.tsx index becb39b0ba..58dbf7aa27 100644 --- a/www/apps/api-reference/components/Tags/Operation/CodeSection/RequestSamples/index.tsx +++ b/www/apps/api-reference/components/Tags/Operation/CodeSection/RequestSamples/index.tsx @@ -1,5 +1,5 @@ import type { Code } from "@/types/openapi" -import { LegacyCodeTabs } from "docs-ui" +import { CodeBlock, CodeTab, CodeTabs } from "docs-ui" import slugify from "slugify" export type TagOperationCodeSectionRequestSamplesProps = { @@ -12,18 +12,17 @@ const TagOperationCodeSectionRequestSamples = ({ return (

Request samples

- ({ - label: codeSample.label, - value: slugify(codeSample.label), - code: { - ...codeSample, - collapsed: true, - className: "!mb-0", - }, - }))} - className="mt-2 !mb-0" - /> + + {codeSamples.map((codeSample, index) => ( + + + + ))} +
) } diff --git a/www/apps/ui/src/components/package-install.tsx b/www/apps/ui/src/components/package-install.tsx index 345813e50e..3119572e9b 100644 --- a/www/apps/ui/src/components/package-install.tsx +++ b/www/apps/ui/src/components/package-install.tsx @@ -1,5 +1,5 @@ import { clx } from "@medusajs/ui" -import { LegacyCodeTabs } from "docs-ui" +import { CodeBlock, CodeTab, CodeTabs } from "docs-ui" type PackageInstallProps = { packageName: string @@ -20,15 +20,20 @@ const PackageInstall = ({ const npm = `npm install ${pkg} ${devDependency ? "--save-dev" : "--save"}` const pnpm = `pnpm add ${devDependency ? "-D " : ""}${pkg}` + const tabs = [ + { code: { lang: "bash", source: npm }, label: "npm", value: "npm" }, + { code: { lang: "bash", source: yarn }, label: "yarn", value: "yarn" }, + { code: { lang: "bash", source: pnpm }, label: "pnpm", value: "pnpm" }, + ] + return ( - + + {tabs.map((tab, index) => ( + + + + ))} + ) } diff --git a/www/apps/ui/src/providers/search.tsx b/www/apps/ui/src/providers/search.tsx index 95a6754f9a..dfc4ed6332 100644 --- a/www/apps/ui/src/providers/search.tsx +++ b/www/apps/ui/src/providers/search.tsx @@ -1,7 +1,7 @@ "use client" import { - AiAssistantCommandIcon, + AiAssistantIcon, AiAssistantProvider, SearchProvider as UiSearchProvider, searchFiltersV1, @@ -40,7 +40,7 @@ const SearchProvider = ({ children }: SearchProviderProps) => { commands={[ { name: "ai-assistant", - icon: , + icon: , component: ( { ), title: "AI Assistant", badge: { - variant: "purple", + variant: "blue", + badgeType: "shaded", children: "Beta", }, }, diff --git a/www/apps/ui/src/styles/globals.css b/www/apps/ui/src/styles/globals.css index cda80045d0..b1170c9cdc 100644 --- a/www/apps/ui/src/styles/globals.css +++ b/www/apps/ui/src/styles/globals.css @@ -15,7 +15,7 @@ } pre *::selection { - @apply !bg-medusa-code-text-highlight; + @apply !bg-medusa-contrast-bg-highlight; } body { diff --git a/www/packages/docs-ui/src/components/AiAssistant/CommandIcon/index.tsx b/www/packages/docs-ui/src/components/AiAssistant/CommandIcon/index.tsx deleted file mode 100644 index 852142a610..0000000000 --- a/www/packages/docs-ui/src/components/AiAssistant/CommandIcon/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { SparklesSolid } from "@medusajs/icons" -import clsx from "clsx" -import React from "react" - -export type AiAssistantCommandIconProps = - React.AllHTMLAttributes - -export const AiAssistantCommandIcon = ({ - className, - ...props -}: AiAssistantCommandIconProps) => { - return ( - - - - ) -} diff --git a/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/Actions/index.tsx b/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/Actions/index.tsx index f02dd2a93a..5840f301d4 100644 --- a/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/Actions/index.tsx +++ b/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/Actions/index.tsx @@ -75,7 +75,7 @@ export const AiAssistantThreadItemActions = ({ const ActionButton = ({ children, className, ...props }: ButtonProps) => { return ( - - ))} - - - <> - {selectedTab?.code && ( - - )} - {selectedTab?.codeBlock && <>{selectedTab.codeBlock}} - - - ) -} diff --git a/www/packages/docs-ui/src/components/Modal/Header/index.tsx b/www/packages/docs-ui/src/components/Modal/Header/index.tsx index 325b8e27c7..bb224f4453 100644 --- a/www/packages/docs-ui/src/components/Modal/Header/index.tsx +++ b/www/packages/docs-ui/src/components/Modal/Header/index.tsx @@ -20,7 +20,7 @@ export const ModalHeader = ({ title }: ModalHeaderProps) => { > {title} )} diff --git a/www/packages/docs-ui/src/components/Search/Suggestions/index.tsx b/www/packages/docs-ui/src/components/Search/Suggestions/index.tsx index 9c91b9e895..57edec6e3e 100644 --- a/www/packages/docs-ui/src/components/Search/Suggestions/index.tsx +++ b/www/packages/docs-ui/src/components/Search/Suggestions/index.tsx @@ -30,13 +30,13 @@ export const SearchSuggestions = ({ suggestions }: SearchSuggestionsProps) => { onClick={() => setCommand(command)} key={index} tabIndex={index} - className="gap-docs_0.75" + className="justify-between" > - <> + {command.icon} {command.title} - {command.badge && } - + + {command.badge && } ))} diff --git a/www/packages/docs-ui/src/components/Search/index.tsx b/www/packages/docs-ui/src/components/Search/index.tsx index 03505afff6..821e67f308 100644 --- a/www/packages/docs-ui/src/components/Search/index.tsx +++ b/www/packages/docs-ui/src/components/Search/index.tsx @@ -122,7 +122,7 @@ export const Search = ({ formRef={searchBoxRef} />