diff --git a/package.json b/package.json index 8267434e..7d373a5c 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "react": "^19.2.6", "react-dom": "^19.2.6", "sass": "^1.100.0", - "shadcn": "^4.8.0", "sharp": "^0.34.5", "tailwind-merge": "^3.6.0", "tw-animate-css": "^1.4.0", diff --git a/src/app/(landing)/[locale]/layout.tsx b/src/app/(landing)/[locale]/layout.tsx index 461c2aa6..94227608 100644 --- a/src/app/(landing)/[locale]/layout.tsx +++ b/src/app/(landing)/[locale]/layout.tsx @@ -2,8 +2,7 @@ import ConsentManager from "@/components/providers/ConsentManager" import { Navigation } from "@/components/navigation/Navigation" import { FooterSection } from "@/components/sections/FooterSection" import { getFooter } from "@/lib/cms" -import { getNavbarButtons } from "@/lib/cms" -import { getNavbarItems } from "@/lib/cms" +import { getNavigation } from "@/lib/cms" import { isSupportedLocale } from "@/lib/i18n" import type { ReactNode } from "react" import { notFound } from "next/navigation" @@ -21,16 +20,17 @@ export default async function LocaleLayout({ children, params }: LocaleLayoutPro notFound() } - const [items, buttons, footer] = await Promise.all([ - getNavbarItems(locale), - getNavbarButtons(locale), + const [navigation, footer] = await Promise.all([ + getNavigation(locale), getFooter(locale), ]) + const items = navigation?.items?.items ?? [] + const buttons = navigation?.buttons?.buttons ?? [] return (
- +
{children}
diff --git a/src/collections/navbarButtons.ts b/src/collections/navbarButtons.ts deleted file mode 100644 index 45b585c0..00000000 --- a/src/collections/navbarButtons.ts +++ /dev/null @@ -1,59 +0,0 @@ -import type { CollectionConfig } from "payload" - -export const NavbarButtons: CollectionConfig = { - slug: "navbarButtons", - admin: { - useAsTitle: "title", - defaultColumns: ["title", "href", "order", "variant", "updatedAt"], - }, - access: { - read: () => true, - create: ({ req }) => Boolean(req.user), - update: ({ req }) => Boolean(req.user), - delete: ({ req }) => Boolean(req.user), - }, - fields: [ - { - name: "title", - type: "text", - required: true, - localized: true, - }, - { - name: "href", - type: "text", - required: true, - }, - { - name: "order", - type: "number", - required: true, - defaultValue: 0, - }, - { - name: "icon", - type: "text", - required: false, - admin: { - description: 'Tabler Icon Name, z.B. "brand-github", oder Simple Icon mit "si", z.B. "siGithub". Leer lassen für kein Icon.', - }, - }, - { - name: "newTab", - type: "checkbox", - defaultValue: false, - }, - { - name: "variant", - type: "select", - required: true, - defaultValue: "normal", - options: [ - { label: "None", value: "none" }, - { label: "Normal", value: "normal" }, - { label: "Outlined", value: "outlined" }, - { label: "Filled", value: "filled" }, - ], - }, - ], -} diff --git a/src/collections/navbarItems.ts b/src/collections/navbarItems.ts deleted file mode 100644 index f7815b40..00000000 --- a/src/collections/navbarItems.ts +++ /dev/null @@ -1,74 +0,0 @@ -import type { CollectionConfig } from "payload" - -export const NavbarItems: CollectionConfig = { - slug: "navbarItems", - admin: { - useAsTitle: "title", - defaultColumns: ["title", "href", "order", "updatedAt"], - }, - access: { - read: () => true, - create: ({ req }) => Boolean(req.user), - update: ({ req }) => Boolean(req.user), - delete: ({ req }) => Boolean(req.user), - }, - fields: [ - { - name: "title", - type: "text", - required: true, - localized: true, - }, - { - name: "href", - type: "text", - admin: { - description: "Leer lassen, wenn ein Submenu angezeigt werden soll.", - }, - }, - { - name: "order", - type: "number", - required: true, - defaultValue: 0, - }, - { - name: "subMenu", - type: "array", - required: false, - fields: [ - { - name: "key", - type: "text", - required: true, - }, - { - name: "title", - type: "text", - required: true, - localized: true, - }, - { - name: "href", - type: "text", - required: true, - }, - { - name: "description", - type: "textarea", - required: true, - localized: true, - }, - { - name: "icon", - type: "text", - required: true, - admin: { - description: - 'Tabler Icon Name. Unbekannte Werte fallen auf "cube" zurück.', - }, - }, - ], - }, - ], -} diff --git a/src/components/navigation/Navigation.tsx b/src/components/navigation/Navigation.tsx index 47241132..60761cc7 100644 --- a/src/components/navigation/Navigation.tsx +++ b/src/components/navigation/Navigation.tsx @@ -1,23 +1,23 @@ -import type { NavbarItem } from "@/payload-types" import { type AppLocale } from "@/lib/i18n" -import type { NavbarButtonData } from "@/lib/navigation" +import type { NavigationLogoData, NavbarButtonData, NavbarItemData } from "@/lib/navigation" import { NavigationDesktop } from "./NavigationDesktop" import { NavigationMobile } from "./NavigationMobile" interface NavigationProps { locale: AppLocale - items: NavbarItem[] + items: NavbarItemData[] buttons: NavbarButtonData[] + logo?: NavigationLogoData } -export function Navigation({ locale, items, buttons }: NavigationProps) { +export function Navigation({ locale, items, buttons, logo }: NavigationProps) { return ( <>
- +
- +
) diff --git a/src/components/navigation/NavigationDesktop.tsx b/src/components/navigation/NavigationDesktop.tsx index 8a399dd3..2012d962 100644 --- a/src/components/navigation/NavigationDesktop.tsx +++ b/src/components/navigation/NavigationDesktop.tsx @@ -4,8 +4,7 @@ import { cn } from "@/lib/utils" import { useNavigationScrollState } from "@/hooks/useNavigationScrollState" import { useNavigationViewModel } from "@/hooks/useNavigationViewModel" import { type AppLocale } from "@/lib/i18n" -import type { NavbarButtonData } from "@/lib/navigation" -import type { NavbarItem } from "@/payload-types" +import type { NavigationLogoData, NavbarButtonData, NavbarItemData } from "@/lib/navigation" import { NavigationMenu, NavigationMenuContent, @@ -25,11 +24,12 @@ import { NavigationSubMenu } from "./NavigationSubMenu" type NavigationDesktopProps = { locale: AppLocale - items: NavbarItem[] + items: NavbarItemData[] buttons: NavbarButtonData[] + logo?: NavigationLogoData } -const NavigationDesktop: React.FC = ({ locale, items, buttons }) => { +const NavigationDesktop: React.FC = ({ locale, items, buttons, logo }) => { const rootRef = useRef(null) const navTabsRef = useRef(null) const submenuContentRef = useRef(null) @@ -38,7 +38,7 @@ const NavigationDesktop: React.FC = ({ locale, items, bu const [activeMenuValue, setActiveMenuValue] = useState(null) const [shellInsetWidth, setShellInsetWidth] = useState(0) const [submenuHeight, setSubmenuHeight] = useState(0) - const { homeHref, navbarItems, navbarButtons } = useNavigationViewModel(locale, items, buttons) + const { homeHref, navbarItems, navbarButtons, logo: navigationLogo } = useNavigationViewModel(locale, items, buttons, logo) const isScrolled = useNavigationScrollState({ onScroll: () => { suppressMenuOpenRef.current = true @@ -160,7 +160,7 @@ const NavigationDesktop: React.FC = ({ locale, items, bu
- {"Code0 +
@@ -293,3 +293,20 @@ const NavigationDesktop: React.FC = ({ locale, items, bu } export { NavigationDesktop } + +function NavigationLogo({ logo }: { logo?: NavigationLogoData }) { + if (logo && typeof logo !== "number" && logo.url) { + return ( + {logo.alt + ) + } + + return Code0 Logo +} diff --git a/src/components/navigation/NavigationMobile.tsx b/src/components/navigation/NavigationMobile.tsx index 761a962f..836f0e94 100644 --- a/src/components/navigation/NavigationMobile.tsx +++ b/src/components/navigation/NavigationMobile.tsx @@ -5,8 +5,7 @@ import { useNavigationScrollState } from "@/hooks/useNavigationScrollState" import { useNavigationViewModel } from "@/hooks/useNavigationViewModel" import { useOutsideClick } from "@/hooks/useOutsideClick" import { type AppLocale } from "@/lib/i18n" -import type { NavbarButtonData } from "@/lib/navigation" -import type { NavbarItem } from "@/payload-types" +import type { NavigationLogoData, NavbarButtonData, NavbarItemData } from "@/lib/navigation" import { Container } from "@code0-tech/pictor" import { IconMenu2, IconX } from "@tabler/icons-react" import { AnimatePresence, m as motion } from "motion/react" @@ -19,11 +18,12 @@ import { NavigationMobileItem } from "./NavigationMobileItem" type NavigationMobileProps = { locale: AppLocale - items: NavbarItem[] + items: NavbarItemData[] buttons: NavbarButtonData[] + logo?: NavigationLogoData } -const NavigationMobile: React.FC = ({ locale, items, buttons }) => { +const NavigationMobile: React.FC = ({ locale, items, buttons, logo }) => { const { trigger } = useWebHaptics() const menuRef = useOutsideClick(() => setIsOpen(false)) const rootRef = useRef(null) @@ -32,7 +32,7 @@ const NavigationMobile: React.FC = ({ locale, items, butt const [mobileOpenKey, setMobileOpenKey] = useState(null) const [isMenuClosing, setIsMenuClosing] = useState(false) const [shellInsetWidth, setShellInsetWidth] = useState(0) - const { homeHref, navbarItems, navbarButtons } = useNavigationViewModel(locale, items, buttons) + const { homeHref, navbarItems, navbarButtons, logo: navigationLogo } = useNavigationViewModel(locale, items, buttons, logo) const menuTransition = { duration: 0.34, ease: [0.16, 1, 0.3, 1] as const, @@ -153,7 +153,7 @@ const NavigationMobile: React.FC = ({ locale, items, butt }} >
- {"Code0 +