diff --git a/packages/generators/src/generators/component/__snapshots__/component-generator.spec.ts.snap b/packages/generators/src/generators/component/__snapshots__/component-generator.spec.ts.snap index 29ac563..23533e1 100644 --- a/packages/generators/src/generators/component/__snapshots__/component-generator.spec.ts.snap +++ b/packages/generators/src/generators/component/__snapshots__/component-generator.spec.ts.snap @@ -790,6 +790,93 @@ exports[`component generator should create files for header 1`] = ` } `; +exports[`component generator should create files for layout 1`] = ` +{ + ".prettierrc": { + "content": [ + "{ "singleQuote": true }", + ], + "isBinary": false, + "path": "./.prettierrc", + }, + "nx.json": { + "content": [ + "{", + ""affected": { "defaultBase": "main" },", + ""targetDefaults": {", + ""build": { "cache": true },", + ""lint": { "cache": true },", + ""e2e": { "cache": true }", + "}", + "}", + ], + "isBinary": false, + "path": "./nx.json", + }, + "package.json": { + "content": [ + "{", + ""name": "@proj/source",", + ""dependencies": {},", + ""devDependencies": {}", + "}", + ], + "isBinary": false, + "path": "./package.json", + }, + "test": { + "children": { + "index.ts": { + "content": [ + "export * from './ui-layout';", + ], + "isBinary": false, + "path": "./test/index.ts", + }, + "ui-layout.tsx": { + "content": [ + "import { AppShell, AppShellProps, Loader, rem } from '@mantine/core';", + "import { ReactNode, Suspense } from 'react';", + "export function UiLayout({", + "children,", + "header,", + "headerHeight = rem(56),", + "...props", + "}: Omit & {", + "children: ReactNode;", + "header: ReactNode;", + "headerHeight?: string;", + "}) {", + "return (", + "", + "{header}", + "", + "}>{children}", + "", + "", + ");", + "}", + ], + "isBinary": false, + "path": "./test/ui-layout.tsx", + }, + }, + "path": "./test", + }, + "tsconfig.base.json": { + "content": [ + "{", + ""compilerOptions": {", + ""paths": {}", + "}", + "}", + ], + "isBinary": false, + "path": "./tsconfig.base.json", + }, +} +`; + exports[`component generator should create files for logo 1`] = ` { ".prettierrc": { @@ -1641,6 +1728,104 @@ exports[`component generator should create files for theme 1`] = ` } `; +exports[`component generator should create files for theme-switch 1`] = ` +{ + ".prettierrc": { + "content": [ + "{ "singleQuote": true }", + ], + "isBinary": false, + "path": "./.prettierrc", + }, + "nx.json": { + "content": [ + "{", + ""affected": { "defaultBase": "main" },", + ""targetDefaults": {", + ""build": { "cache": true },", + ""lint": { "cache": true },", + ""e2e": { "cache": true }", + "}", + "}", + ], + "isBinary": false, + "path": "./nx.json", + }, + "package.json": { + "content": [ + "{", + ""name": "@proj/source",", + ""dependencies": {},", + ""devDependencies": {}", + "}", + ], + "isBinary": false, + "path": "./package.json", + }, + "test": { + "children": { + "index.ts": { + "content": [ + "export * from './ui-theme-switch';", + ], + "isBinary": false, + "path": "./test/index.ts", + }, + "ui-theme-switch.tsx": { + "content": [ + "import { rem, Switch, SwitchProps, useMantineTheme } from '@mantine/core';", + "import { IconMoonStars, IconSun } from '@tabler/icons-react';", + "import { useUiColorScheme } from '../ui-theme';", + "export function UiThemeSwitch(props: SwitchProps) {", + "const theme = useMantineTheme();", + "const sunIcon = (", + "", + ");", + "const moonIcon = (", + "", + ");", + "const { toggleColorScheme, colorScheme } = useUiColorScheme();", + "return (", + " toggleColorScheme()}", + "checked={colorScheme === 'dark'}", + "{...props}", + "/>", + ");", + "}", + ], + "isBinary": false, + "path": "./test/ui-theme-switch.tsx", + }, + }, + "path": "./test", + }, + "tsconfig.base.json": { + "content": [ + "{", + ""compilerOptions": {", + ""paths": {}", + "}", + "}", + ], + "isBinary": false, + "path": "./tsconfig.base.json", + }, +} +`; + exports[`component generator should create files for time 1`] = ` { ".prettierrc": { diff --git a/packages/generators/src/generators/components/__snapshots__/components-generator.spec.ts.snap b/packages/generators/src/generators/components/__snapshots__/components-generator.spec.ts.snap index 25036e6..649739c 100644 --- a/packages/generators/src/generators/components/__snapshots__/components-generator.spec.ts.snap +++ b/packages/generators/src/generators/components/__snapshots__/components-generator.spec.ts.snap @@ -45,12 +45,14 @@ exports[`components generator should run successfully 1`] = ` "export * from './ui-debug';", "export * from './ui-group';", "export * from './ui-header';", + "export * from './ui-layout';", "export * from './ui-logo';", "export * from './ui-menu';", "export * from './ui-search-input';", "export * from './ui-stack';", "export * from './ui-tab-routes';", "export * from './ui-theme';", + "export * from './ui-theme-switch';", "export * from './ui-time';", "export * from './ui-toast';", ], @@ -511,6 +513,45 @@ exports[`components generator should run successfully 1`] = ` }, "path": "./test/ui-header", }, + "ui-layout": { + "children": { + "index.ts": { + "content": [ + "export * from './ui-layout';", + ], + "isBinary": false, + "path": "./test/ui-layout/index.ts", + }, + "ui-layout.tsx": { + "content": [ + "import { AppShell, AppShellProps, Loader, rem } from '@mantine/core';", + "import { ReactNode, Suspense } from 'react';", + "export function UiLayout({", + "children,", + "header,", + "headerHeight = rem(56),", + "...props", + "}: Omit & {", + "children: ReactNode;", + "header: ReactNode;", + "headerHeight?: string;", + "}) {", + "return (", + "", + "{header}", + "", + "}>{children}", + "", + "", + ");", + "}", + ], + "isBinary": false, + "path": "./test/ui-layout/ui-layout.tsx", + }, + }, + "path": "./test/ui-layout", + }, "ui-logo": { "children": { "index.ts": { @@ -1074,6 +1115,56 @@ exports[`components generator should run successfully 1`] = ` }, "path": "./test/ui-theme", }, + "ui-theme-switch": { + "children": { + "index.ts": { + "content": [ + "export * from './ui-theme-switch';", + ], + "isBinary": false, + "path": "./test/ui-theme-switch/index.ts", + }, + "ui-theme-switch.tsx": { + "content": [ + "import { rem, Switch, SwitchProps, useMantineTheme } from '@mantine/core';", + "import { IconMoonStars, IconSun } from '@tabler/icons-react';", + "import { useUiColorScheme } from '../ui-theme';", + "export function UiThemeSwitch(props: SwitchProps) {", + "const theme = useMantineTheme();", + "const sunIcon = (", + "", + ");", + "const moonIcon = (", + "", + ");", + "const { toggleColorScheme, colorScheme } = useUiColorScheme();", + "return (", + " toggleColorScheme()}", + "checked={colorScheme === 'dark'}", + "{...props}", + "/>", + ");", + "}", + ], + "isBinary": false, + "path": "./test/ui-theme-switch/ui-theme-switch.tsx", + }, + }, + "path": "./test/ui-theme-switch", + }, "ui-time": { "children": { "index.ts": { diff --git a/packages/generators/src/generators/feature/__snapshots__/feature-generator.spec.ts.snap b/packages/generators/src/generators/feature/__snapshots__/feature-generator.spec.ts.snap index 0cc2792..e2f5910 100644 --- a/packages/generators/src/generators/feature/__snapshots__/feature-generator.spec.ts.snap +++ b/packages/generators/src/generators/feature/__snapshots__/feature-generator.spec.ts.snap @@ -40,8 +40,8 @@ exports[`feature generator should create files for demo 1`] = ` "content": [ "import { SimpleGrid } from '@mantine/core';", "import {", - "UiCard,", "UiAlert,", + "UiCard,", "UiError,", "UiInfo,", "UiSuccess,", @@ -70,6 +70,7 @@ exports[`feature generator should create files for demo 1`] = ` "export function DemoFeatureCard() {", "return (", "", + "CARD CONTENT", "", "CARD CONTENT", "", @@ -150,22 +151,224 @@ exports[`feature generator should create files for demo 1`] = ` "isBinary": false, "path": "./test/demo-feature-group.tsx", }, + "demo-feature-header.tsx": { + "content": [ + "import { ActionIcon, Avatar, Button, Group, rem, Text } from '@mantine/core';", + "import { useDisclosure } from '@mantine/hooks';", + "import {", + "UiCard,", + "UiHeader,", + "UiMenu,", + "UiSearchInput,", + "UiStack,", + "} from '@pubkey-ui/core';", + "import {", + "IconDoorExit,", + "IconLetterP,", + "IconMessageCircle,", + "IconPhoto,", + "IconSearch,", + "IconSettings,", + "IconUser,", + "IconUserCog,", + "} from '@tabler/icons-react';", + "import { useState } from 'react';", + "import { Route, Routes } from 'react-router-dom';", + "export function DemoFeatureHeader() {", + "const [opened, { toggle }] = useDisclosure(false);", + "const [signedIn, setSignedIn] = useState(false);", + "return (", + "", + "", + "}", + "/>", + "", + "", + "", + "}", + "/>", + "", + "", + "", + "PubKey", + "", + "", + "}", + "logoSmall={}", + "/>", + "", + "{signedIn ? (", + "", + "", + "", + "}", + "items={[", + "{ label: 'Application', type: 'label' },", + "{", + "label: 'Settings',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Messages',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Gallery',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Search',", + "type: 'item',", + "leftSection: (", + "", + "),", + "rightSection: (", + "", + "⌘K", + "", + "),", + "},", + "{", + "label: 'Account',", + "type: 'label',", + "},", + "{", + "label: 'Profile',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Sign out',", + "type: 'item',", + "leftSection: (", + "", + "),", + "onClick: () => setSignedIn(false),", + "},", + "]}", + "/>", + ") : (", + " setSignedIn(true)}", + ">", + "Sign in", + "", + ")}", + "", + "}", + "/>", + "", + "{opened ? (", + "", + ") : (", + "", + ")}", + "", + "", + "About} />", + "Pricing} />", + "Learn} />", + "", + "", + "", + ");", + "}", + ], + "isBinary": false, + "path": "./test/demo-feature-header.tsx", + }, "demo-feature-logo.tsx": { "content": [ "import { SimpleGrid } from '@mantine/core';", "import {", "UiCard,", + "UiGroup,", + "UiLogo,", "UiLogoType,", "UiLogoTypeBlack,", "UiLogoTypeWhite,", + "UiStack,", + "UiThemeSwitch,", "} from '@pubkey-ui/core';", "export function DemoFeatureLogo() {", "return (", - "", + "", "", - "", + "", + "", + "", + "", + "", + "", + "", "", + "", + "", "", + "", + "", + "", + "", + "", + "", + "Toggle the theme to see the logo change color.", + "", + "", + "", "", "", ");", @@ -174,13 +377,111 @@ exports[`feature generator should create files for demo 1`] = ` "isBinary": false, "path": "./test/demo-feature-logo.tsx", }, + "demo-feature-menu.tsx": { + "content": [ + "import { Avatar, rem, Text } from '@mantine/core';", + "import {", + "UiCard,", + "UiGroup,", + "UiMenu,", + "UiMenuItem,", + "useUiColorScheme,", + "} from '@pubkey-ui/core';", + "import {", + "IconDoorExit,", + "IconMessageCircle,", + "IconMoon,", + "IconPhoto,", + "IconSearch,", + "IconSettings,", + "IconSun,", + "IconUser,", + "IconUserCog,", + "} from '@tabler/icons-react';", + "import { ReactNode } from 'react';", + "export function DemoFeatureMenu() {", + "const { colorScheme, toggleColorScheme } = useUiColorScheme();", + "const icon: ReactNode = (", + "", + "", + "", + ");", + "const items: UiMenuItem[] = [", + "{ label: 'Application', type: 'label' },", + "{", + "label: 'Settings',", + "type: 'item',", + "leftSection: ,", + "},", + "{", + "label: 'Messages',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Gallery',", + "type: 'item',", + "leftSection: ,", + "},", + "{", + "label: 'Search',", + "type: 'item',", + "leftSection: ,", + "rightSection: (", + "", + "⌘K", + "", + "),", + "},", + "{", + "label: \`\${colorScheme === 'dark' ? 'Light' : 'Dark'} theme\`,", + "type: 'item',", + "leftSection:", + "colorScheme === 'dark' ? (", + "", + ") : (", + "", + "),", + "onClick: () => toggleColorScheme(),", + "},", + "{", + "label: 'Account',", + "type: 'label',", + "},", + "{", + "label: 'Profile',", + "type: 'item',", + "leftSection: ,", + "},", + "{", + "label: 'Sign out',", + "type: 'item',", + "leftSection: ,", + "},", + "];", + "return (", + "", + "", + "", + "", + "", + "", + ");", + "}", + ], + "isBinary": false, + "path": "./test/demo-feature-menu.tsx", + }, "demo-feature-search-input.tsx": { "content": [ "import { SimpleGrid } from '@mantine/core';", - "import { UiCard, UiGroup, UiSearchInput } from '@pubkey-ui/core';", + "import { UiCard, UiGroup, UiSearchInput, UiStack } from '@pubkey-ui/core';", "export function DemoFeatureSearchInput() {", "return (", "", + "", "", "", "", @@ -192,6 +493,7 @@ exports[`feature generator should create files for demo 1`] = ` "", "", "", + "", "", ");", "}", @@ -239,9 +541,9 @@ exports[`feature generator should create files for demo 1`] = ` "import { UiCard, UiTabRoutes } from '@pubkey-ui/core';", "export function DemoFeatureTabRoutes() {", "return (", - "", + "", " },", + "{ path: 'card', label: 'Card', element: },", + "{ path: 'copy', label: 'Copy', element: },", + "{ path: 'debug', label: 'Debug', element: },", + "{ path: 'group', label: 'Group', element: },", + "{ path: 'header', label: 'Header', element: },", + "{ path: 'logo', label: 'Logo', element: },", + "{ path: 'menu', label: 'Menu', element: },", + "{", + "path: 'search-input',", + "label: 'Search Input',", + "element: ,", + "},", + "{ path: 'stack', label: 'Stack', element: },", + "{", + "path: 'tab-routes',", + "label: 'Tab Routes',", + "element: ,", + "},", + "{ path: 'time', label: 'Time', element: },", + "{ path: 'toast', label: 'Toast', element: },", + "];", + "const routes = useRoutes([", + "{ index: true, element: },", + "...demos.map((demo) => ({ path: \`\${demo.path}/*\`, element: demo.element })),", + "]);", "return (", "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + "", + "", + "{demos.map((demo) => {", + "const to = \`/demo/\${demo.path}\`;", + "return (", + "", + ");", + "})}", + "", + "", + "{routes}", + "", + "", "", ");", "}", diff --git a/packages/generators/src/generators/features/__snapshots__/features-generator.spec.ts.snap b/packages/generators/src/generators/features/__snapshots__/features-generator.spec.ts.snap index 21a28ba..b65bf8d 100644 --- a/packages/generators/src/generators/features/__snapshots__/features-generator.spec.ts.snap +++ b/packages/generators/src/generators/features/__snapshots__/features-generator.spec.ts.snap @@ -42,8 +42,8 @@ exports[`features generator should run successfully 1`] = ` "content": [ "import { SimpleGrid } from '@mantine/core';", "import {", - "UiCard,", "UiAlert,", + "UiCard,", "UiError,", "UiInfo,", "UiSuccess,", @@ -72,6 +72,7 @@ exports[`features generator should run successfully 1`] = ` "export function DemoFeatureCard() {", "return (", "", + "CARD CONTENT", "", "CARD CONTENT", "", @@ -152,22 +153,224 @@ exports[`features generator should run successfully 1`] = ` "isBinary": false, "path": "./test/demo/demo-feature-group.tsx", }, + "demo-feature-header.tsx": { + "content": [ + "import { ActionIcon, Avatar, Button, Group, rem, Text } from '@mantine/core';", + "import { useDisclosure } from '@mantine/hooks';", + "import {", + "UiCard,", + "UiHeader,", + "UiMenu,", + "UiSearchInput,", + "UiStack,", + "} from '@pubkey-ui/core';", + "import {", + "IconDoorExit,", + "IconLetterP,", + "IconMessageCircle,", + "IconPhoto,", + "IconSearch,", + "IconSettings,", + "IconUser,", + "IconUserCog,", + "} from '@tabler/icons-react';", + "import { useState } from 'react';", + "import { Route, Routes } from 'react-router-dom';", + "export function DemoFeatureHeader() {", + "const [opened, { toggle }] = useDisclosure(false);", + "const [signedIn, setSignedIn] = useState(false);", + "return (", + "", + "", + "}", + "/>", + "", + "", + "", + "}", + "/>", + "", + "", + "", + "PubKey", + "", + "", + "}", + "logoSmall={}", + "/>", + "", + "{signedIn ? (", + "", + "", + "", + "}", + "items={[", + "{ label: 'Application', type: 'label' },", + "{", + "label: 'Settings',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Messages',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Gallery',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Search',", + "type: 'item',", + "leftSection: (", + "", + "),", + "rightSection: (", + "", + "⌘K", + "", + "),", + "},", + "{", + "label: 'Account',", + "type: 'label',", + "},", + "{", + "label: 'Profile',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Sign out',", + "type: 'item',", + "leftSection: (", + "", + "),", + "onClick: () => setSignedIn(false),", + "},", + "]}", + "/>", + ") : (", + " setSignedIn(true)}", + ">", + "Sign in", + "", + ")}", + "", + "}", + "/>", + "", + "{opened ? (", + "", + ") : (", + "", + ")}", + "", + "", + "About} />", + "Pricing} />", + "Learn} />", + "", + "", + "", + ");", + "}", + ], + "isBinary": false, + "path": "./test/demo/demo-feature-header.tsx", + }, "demo-feature-logo.tsx": { "content": [ "import { SimpleGrid } from '@mantine/core';", "import {", "UiCard,", + "UiGroup,", + "UiLogo,", "UiLogoType,", "UiLogoTypeBlack,", "UiLogoTypeWhite,", + "UiStack,", + "UiThemeSwitch,", "} from '@pubkey-ui/core';", "export function DemoFeatureLogo() {", "return (", - "", + "", "", - "", + "", + "", + "", + "", + "", + "", + "", "", + "", + "", "", + "", + "", + "", + "", + "", + "", + "Toggle the theme to see the logo change color.", + "", + "", + "", "", "", ");", @@ -176,13 +379,111 @@ exports[`features generator should run successfully 1`] = ` "isBinary": false, "path": "./test/demo/demo-feature-logo.tsx", }, + "demo-feature-menu.tsx": { + "content": [ + "import { Avatar, rem, Text } from '@mantine/core';", + "import {", + "UiCard,", + "UiGroup,", + "UiMenu,", + "UiMenuItem,", + "useUiColorScheme,", + "} from '@pubkey-ui/core';", + "import {", + "IconDoorExit,", + "IconMessageCircle,", + "IconMoon,", + "IconPhoto,", + "IconSearch,", + "IconSettings,", + "IconSun,", + "IconUser,", + "IconUserCog,", + "} from '@tabler/icons-react';", + "import { ReactNode } from 'react';", + "export function DemoFeatureMenu() {", + "const { colorScheme, toggleColorScheme } = useUiColorScheme();", + "const icon: ReactNode = (", + "", + "", + "", + ");", + "const items: UiMenuItem[] = [", + "{ label: 'Application', type: 'label' },", + "{", + "label: 'Settings',", + "type: 'item',", + "leftSection: ,", + "},", + "{", + "label: 'Messages',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Gallery',", + "type: 'item',", + "leftSection: ,", + "},", + "{", + "label: 'Search',", + "type: 'item',", + "leftSection: ,", + "rightSection: (", + "", + "⌘K", + "", + "),", + "},", + "{", + "label: \`\${colorScheme === 'dark' ? 'Light' : 'Dark'} theme\`,", + "type: 'item',", + "leftSection:", + "colorScheme === 'dark' ? (", + "", + ") : (", + "", + "),", + "onClick: () => toggleColorScheme(),", + "},", + "{", + "label: 'Account',", + "type: 'label',", + "},", + "{", + "label: 'Profile',", + "type: 'item',", + "leftSection: ,", + "},", + "{", + "label: 'Sign out',", + "type: 'item',", + "leftSection: ,", + "},", + "];", + "return (", + "", + "", + "", + "", + "", + "", + ");", + "}", + ], + "isBinary": false, + "path": "./test/demo/demo-feature-menu.tsx", + }, "demo-feature-search-input.tsx": { "content": [ "import { SimpleGrid } from '@mantine/core';", - "import { UiCard, UiGroup, UiSearchInput } from '@pubkey-ui/core';", + "import { UiCard, UiGroup, UiSearchInput, UiStack } from '@pubkey-ui/core';", "export function DemoFeatureSearchInput() {", "return (", "", + "", "", "", "", @@ -194,6 +495,7 @@ exports[`features generator should run successfully 1`] = ` "", "", "", + "", "", ");", "}", @@ -241,9 +543,9 @@ exports[`features generator should run successfully 1`] = ` "import { UiCard, UiTabRoutes } from '@pubkey-ui/core';", "export function DemoFeatureTabRoutes() {", "return (", - "", + "", " },", + "{ path: 'card', label: 'Card', element: },", + "{ path: 'copy', label: 'Copy', element: },", + "{ path: 'debug', label: 'Debug', element: },", + "{ path: 'group', label: 'Group', element: },", + "{ path: 'header', label: 'Header', element: },", + "{ path: 'logo', label: 'Logo', element: },", + "{ path: 'menu', label: 'Menu', element: },", + "{", + "path: 'search-input',", + "label: 'Search Input',", + "element: ,", + "},", + "{ path: 'stack', label: 'Stack', element: },", + "{", + "path: 'tab-routes',", + "label: 'Tab Routes',", + "element: ,", + "},", + "{ path: 'time', label: 'Time', element: },", + "{ path: 'toast', label: 'Toast', element: },", + "];", + "const routes = useRoutes([", + "{ index: true, element: },", + "...demos.map((demo) => ({ path: \`\${demo.path}/*\`, element: demo.element })),", + "]);", "return (", "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + "", + "", + "{demos.map((demo) => {", + "const to = \`/demo/\${demo.path}\`;", + "return (", + "", + ");", + "})}", + "", + "", + "{routes}", + "", + "", "", ");", "}", diff --git a/packages/generators/src/generators/theme/__snapshots__/theme-generator.spec.ts.snap b/packages/generators/src/generators/theme/__snapshots__/theme-generator.spec.ts.snap index 4c4eed7..2a036a6 100644 --- a/packages/generators/src/generators/theme/__snapshots__/theme-generator.spec.ts.snap +++ b/packages/generators/src/generators/theme/__snapshots__/theme-generator.spec.ts.snap @@ -76,40 +76,81 @@ exports[`theme generator should run successfully 1`] = ` "children": { "app-layout.tsx": { "content": [ - "import { ActionIcon, Anchor, Box, Card, Group } from '@mantine/core';", - "import { UiContainer, UiLogoType, useUiColorScheme, useUiTheme } from './ui';", - "import { IconMoon, IconSun } from '@tabler/icons-react';", + "import { ActionIcon, Avatar, Group, rem } from '@mantine/core';", + "import { UiHeader, UiLayout, UiMenu, useUiColorScheme } from '@pubkey-ui/core';", + "import {", + "IconMoon,", + "IconSettings,", + "IconSun,", + "IconUser,", + "IconUserCog,", + "} from '@tabler/icons-react';", "import { ReactNode } from 'react';", + "import { AccountChecker } from './features/account/account-ui';", + "import { ClusterChecker } from './features/cluster/cluster-ui';", "export function AppLayout({ children }: { children: ReactNode }) {", - "const { Link } = useUiTheme();", "return (", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "Dashboard", - "", - "", - "Demo", - "", - "", + "", "", + "", + "", + "", + "}", + "items={[", + "{ label: 'Account', type: 'label' },", + "{", + "label: 'Settings',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "{", + "label: 'Profile',", + "type: 'item',", + "leftSection: (", + "", + "),", + "},", + "]}", + "/>", "", - "", - "", + "}", + "/>", + "}", + ">", + "", + "", + "", "{children}", - "", + "", ");", "}", - "function ThemeToggle() {", + "export function ThemeToggle() {", "const { toggleColorScheme, colorScheme } = useUiColorScheme();", "return (", - "", " toggleColorScheme()}", "variant="default"", @@ -117,12 +158,11 @@ exports[`theme generator should run successfully 1`] = ` "aria-label="Toggle color scheme"", ">", "{colorScheme === 'dark' ? (", - "", + "", ") : (", - "", + "", ")}", "", - "", ");", "}", ], @@ -205,12 +245,14 @@ exports[`theme generator should run successfully 1`] = ` "export * from './ui-debug';", "export * from './ui-group';", "export * from './ui-header';", + "export * from './ui-layout';", "export * from './ui-logo';", "export * from './ui-menu';", "export * from './ui-search-input';", "export * from './ui-stack';", "export * from './ui-tab-routes';", "export * from './ui-theme';", + "export * from './ui-theme-switch';", "export * from './ui-time';", "export * from './ui-toast';", ], @@ -671,6 +713,45 @@ exports[`theme generator should run successfully 1`] = ` }, "path": "./test-target/src/app/ui/ui-header", }, + "ui-layout": { + "children": { + "index.ts": { + "content": [ + "export * from './ui-layout';", + ], + "isBinary": false, + "path": "./test-target/src/app/ui/ui-layout/index.ts", + }, + "ui-layout.tsx": { + "content": [ + "import { AppShell, AppShellProps, Loader, rem } from '@mantine/core';", + "import { ReactNode, Suspense } from 'react';", + "export function UiLayout({", + "children,", + "header,", + "headerHeight = rem(56),", + "...props", + "}: Omit & {", + "children: ReactNode;", + "header: ReactNode;", + "headerHeight?: string;", + "}) {", + "return (", + "", + "{header}", + "", + "}>{children}", + "", + "", + ");", + "}", + ], + "isBinary": false, + "path": "./test-target/src/app/ui/ui-layout/ui-layout.tsx", + }, + }, + "path": "./test-target/src/app/ui/ui-layout", + }, "ui-logo": { "children": { "index.ts": { @@ -1234,6 +1315,56 @@ exports[`theme generator should run successfully 1`] = ` }, "path": "./test-target/src/app/ui/ui-theme", }, + "ui-theme-switch": { + "children": { + "index.ts": { + "content": [ + "export * from './ui-theme-switch';", + ], + "isBinary": false, + "path": "./test-target/src/app/ui/ui-theme-switch/index.ts", + }, + "ui-theme-switch.tsx": { + "content": [ + "import { rem, Switch, SwitchProps, useMantineTheme } from '@mantine/core';", + "import { IconMoonStars, IconSun } from '@tabler/icons-react';", + "import { useUiColorScheme } from '../ui-theme';", + "export function UiThemeSwitch(props: SwitchProps) {", + "const theme = useMantineTheme();", + "const sunIcon = (", + "", + ");", + "const moonIcon = (", + "", + ");", + "const { toggleColorScheme, colorScheme } = useUiColorScheme();", + "return (", + " toggleColorScheme()}", + "checked={colorScheme === 'dark'}", + "{...props}", + "/>", + ");", + "}", + ], + "isBinary": false, + "path": "./test-target/src/app/ui/ui-theme-switch/ui-theme-switch.tsx", + }, + }, + "path": "./test-target/src/app/ui/ui-theme-switch", + }, "ui-time": { "children": { "index.ts": {