",
+ "",
"",
"",
"{burger}",
@@ -1408,13 +1433,13 @@ exports[`component generator should create files for header 1`] = `
"",
"",
"",
- "",
+ "",
"{items}",
"",
"",
"{profile}",
- "",
- "",
+ "
",
+ "",
");",
"}",
],
diff --git a/packages/generators/src/generators/component/files/header/__prefixFileName__-header.module.css.template b/packages/generators/src/generators/component/files/header/__prefixFileName__-header.module.css.template
new file mode 100644
index 0000000..6b46067
--- /dev/null
+++ b/packages/generators/src/generators/component/files/header/__prefixFileName__-header.module.css.template
@@ -0,0 +1,32 @@
+.header {
+ height: rem(56px);
+ background-color: light-dark(var(--mantine-color-white), var(--mantine-color-dark-9));
+ padding-left: var(--mantine-spacing-md);
+ padding-right: var(--mantine-spacing-md);
+}
+
+.inner {
+ height: rem(56px);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.link {
+ display: block;
+ line-height: 1;
+ padding: rem(8px) rem(12px);
+ border-radius: var(--mantine-radius-sm);
+ text-decoration: none;
+ color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-0));
+ font-size: var(--mantine-font-size-sm);
+ font-weight: 500;
+
+ @mixin hover {
+ background-color: light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-6));
+ }
+}
+.linkActive {
+ background-color: light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-6));
+ color: light-dark(var(--mantine-color-brand-6), var(--mantine-color-brand-4));
+}
diff --git a/packages/generators/src/generators/component/files/header/__prefixFileName__-header.tsx.template b/packages/generators/src/generators/component/files/header/__prefixFileName__-header.tsx.template
index 84acf4b..718a536 100644
--- a/packages/generators/src/generators/component/files/header/__prefixFileName__-header.tsx.template
+++ b/packages/generators/src/generators/component/files/header/__prefixFileName__-header.tsx.template
@@ -1,8 +1,10 @@
-import { Anchor, Box, Burger, Flex, Group, rem } from '@mantine/core'
+import { Anchor, Burger, Group } from '@mantine/core'
import { ReactNode } from 'react'
+import cx from 'clsx'
import { Link, useLocation } from 'react-router-dom'
-import { <%= prefix.className %>Logo, <%= prefix.className %>LogoType } from '../<%= prefix.filenameName %>-logo'
-import { use<%= prefix.className %>ColorScheme } from '../<%= prefix.filenameName %>-theme'
+import { <%= prefix.className %>Logo, <%= prefix.className %>LogoType } from '../<%= prefix.fileName %>-logo'
+
+import classes from './<%= prefix.fileName %>-header.module.css'
export interface <%= prefix.className %>HeaderProps {
base?: string
@@ -19,41 +21,23 @@ export interface <%= prefix.className %>HeaderLink {
}
export function <%= prefix.className %>Header({ base, links = [], logo, logoSmall, opened, profile, toggle }: <%= prefix.className %>HeaderProps) {
- const { colorScheme } = use<%= prefix.className %>ColorScheme()
- const isDark = colorScheme === 'dark'
const { pathname } = useLocation()
- const items = links.map((link) => {
- const active = pathname.startsWith(link.link)
- const linkColor = isDark ? 'gray.4' : 'dark.8'
- const activeLinkColor = isDark ? 'brand.6' : 'brand.4'
-
- return (
-