Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 50 additions & 3 deletions design-system/apps/design-lab/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from "react";
import type { SystemTokenMode } from "@openbitfun/design-tokens";
import type { ThemeDataName } from "@openbitfun/theme-openbitfun";
import { AppWindow, Blocks, BookOpen, Braces, CircleDashed, FileText, House, Languages, Menu, Moon, MousePointerClick, PanelTop, PanelsTopLeft, SquareTerminal, Sun, ToggleLeft, type LucideIcon } from "lucide-react";
import { AppWindow, Blocks, BookOpen, Braces, CircleDashed, FileText, House, Languages, Menu, Moon, MousePointerClick, PanelTop, PanelsTopLeft, Smartphone, SquareTerminal, Sun, ToggleLeft, type LucideIcon } from "lucide-react";
import { Icon as CatalogIcon,
ThemeRoot,
type ColorScheme,
Expand Down Expand Up @@ -53,6 +53,7 @@ type LabRoute =
| { page: "overview" }
| { page: "getting-started" }
| { page: "components" }
| { page: "mobile" }
| { page: "patterns" }
| { page: "flow-chat" }
| { page: "colors" }
Expand Down Expand Up @@ -84,8 +85,13 @@ const componentIcons: Record<string, LucideIcon> = {
const flowChatComponents = componentRegistry.filter(
(component) => component.category === "flow-chat",
);
const mobileComponents = componentRegistry.filter(
(component) => component.category === "mobile",
);
const standardComponents = componentRegistry.filter(
(component) => component.category !== "flow-chat" && component.name !== "Icon",
(component) => component.category !== "flow-chat"
&& component.category !== "mobile"
&& component.name !== "Icon",
);

function getComponentNavGroup(route: LabRoute): ComponentNavGroup | undefined {
Expand Down Expand Up @@ -138,6 +144,9 @@ function parseRoute(hash: string): LabRoute {
if (route === "components") {
return { page: "components" };
}
if (route === "mobile") {
return { page: "mobile" };
}
if (route === "patterns") {
return { page: "patterns" };
}
Expand Down Expand Up @@ -234,6 +243,13 @@ export function App() {
label: t("nav.components"),
route: { page: "components" },
},
{
detail: t("search.mobileDetail", { count: mobileComponents.length }),
icon: Smartphone,
keywords: `mobile touch phone foldable ${t("nav.mobile")}`,
label: t("nav.mobile"),
route: { page: "mobile" },
},
{
detail: t("search.patternsDetail"),
icon: PanelsTopLeft,
Expand Down Expand Up @@ -398,8 +414,13 @@ export function App() {
const isFlowChatRoute = route.page === "flow-chat"
|| activeComponent?.category === "flow-chat";
const isIconRoute = activeComponent?.name === "Icon";
const isMobileRoute = route.page === "mobile"
|| activeComponent?.category === "mobile";
const isStandardComponentRoute = route.page === "components"
|| Boolean(activeComponent && activeComponent.category !== "flow-chat" && !isIconRoute);
|| Boolean(activeComponent
&& activeComponent.category !== "flow-chat"
&& activeComponent.category !== "mobile"
&& !isIconRoute);

return (
<ThemeRoot
Expand Down Expand Up @@ -536,6 +557,18 @@ export function App() {
);
})}
</div>
<a
aria-current={isMobileRoute ? "page" : undefined}
href="#mobile"
onClick={(event) => {
event.preventDefault();
navigate({ page: "mobile" });
}}
>
<Smartphone aria-hidden="true" size={17} />
<span>{t("nav.mobile")}</span>
<small>{mobileComponents.length}</small>
</a>
<a
aria-current={isIconRoute ? "page" : undefined}
href="#component/icon"
Expand Down Expand Up @@ -808,6 +841,18 @@ export function App() {
/>
)}

{route.page === "mobile" && (
<ComponentsPage
category="mobile"
colorScheme={colorScheme}
contrast={contrast}
density={density}
onInspectTokens={() => openTokenPage()}
onOpenComponent={(name) => navigate({ componentName: name, page: "component" })}
tokenOverrides={tokenOverrides}
/>
)}

{route.page === "patterns" && (
<PatternsPage
colorScheme={colorScheme}
Expand Down Expand Up @@ -839,6 +884,8 @@ export function App() {
onBack={() => navigate({
page: activeComponent.category === "flow-chat"
? "flow-chat"
: activeComponent.category === "mobile"
? "mobile"
: "components",
})}
onInspectTokens={openTokenPage}
Expand Down
24 changes: 24 additions & 0 deletions design-system/apps/design-lab/src/i18n/componentMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const categoryKeys: Readonly<Record<string, MessageKey>> = {
"flow-chat": "meta.category.flowChat",
form: "meta.category.form",
navigation: "meta.category.navigation",
mobile: "meta.category.mobile",
primitive: "meta.category.primitive",
};

Expand Down Expand Up @@ -42,6 +43,29 @@ const descriptionKeys: Readonly<Record<string, MessageKey>> = {
LauncherButton: "component.LauncherButton.description",
LoadingState: "component.LoadingState.description",
Menu: "component.Menu.description",
MobileActionSheet: "component.MobileActionSheet.description",
MobileBadge: "component.MobileBadge.description",
MobileBanner: "component.MobileBanner.description",
MobileButton: "component.MobileButton.description",
MobileCard: "component.MobileCard.description",
MobileChoiceSheet: "component.MobileChoiceSheet.description",
MobileConfirmSheet: "component.MobileConfirmSheet.description",
MobileComposer: "component.MobileComposer.description",
MobileDisclosure: "component.MobileDisclosure.description",
MobileFileButton: "component.MobileFileButton.description",
MobileFloatingActions: "component.MobileFloatingActions.description",
MobileIconButton: "component.MobileIconButton.description",
MobileLink: "component.MobileLink.description",
MobileListRow: "component.MobileListRow.description",
MobileMessage: "component.MobileMessage.description",
MobilePageHeader: "component.MobilePageHeader.description",
MobileScrim: "component.MobileScrim.description",
MobileSection: "component.MobileSection.description",
MobileSegmentedControl: "component.MobileSegmentedControl.description",
MobileSheet: "component.MobileSheet.description",
MobileStatus: "component.MobileStatus.description",
MobileTextField: "component.MobileTextField.description",
MobileTextarea: "component.MobileTextarea.description",
Dialog: "component.Dialog.description",
Sheet: "component.Sheet.description",
NavigationPanel: "component.NavigationPanel.description",
Expand Down
Loading
Loading