Hi
- User
Hi
- Assistant
Hello! How can I assist you today?
- User
Kannst du mir erklären wie ich folgende Beispiel Seite in einem Beispiel - React Projekt verwende. Also ich ich möchte das Layout mit Navbar, Header und Main Inhalt von Mantine, wie auf https://mantine.dev/app-shell/?e=BasicAppShell erwähnt. Zeige mir dies anhand einer Grundlegenden durchführung mit 3 Seiten.
- Assistant
- User
Wenn ich npm install @mantine/theme mache erhalte ich einen : npm error 404 '@mantine/types@1.2.0' is not in this registry.
- Assistant
- User
Laut mantine Seite wäre es: import { AppShell, Burger, Group, Skeleton } from '@mantine/core'; import { useDisclosure } from '@mantine/hooks'; import { MantineLogo } from '@mantinex/mantine-logo';
export function BasicAppShell() { const [opened, { toggle }] = useDisclosure();
return ( <AppShell header={{ height: 60 }} navbar={{ width: 300, breakpoint: 'sm', collapsed: { mobile: !opened } }} padding="md" > <AppShell.Header> </AppShell.Header> <AppShell.Navbar p="md"> Navbar {Array(15) .fill(0) .map((_, index) => ( ))} </AppShell.Navbar> <AppShell.Main>Main</AppShell.Main> ); } AppShell examples | Mantine
Also AppShell.Navbar Und AppShell.Header!
- Assistant
- User
import { useState } from 'react'; import { Group, Code } from '@mantine/core'; import { IconBellRinging, IconFingerprint, IconKey, IconSettings, Icon2fa, IconDatabaseImport, IconReceipt2, IconSwitchHorizontal, IconLogout, } from '@tabler/icons-react'; import { MantineLogo } from '@mantinex/mantine-logo'; import classes from './NavbarSimpleColored.module.css';
const data = [ { link: '', label: 'Notifications', icon: IconBellRinging }, { link: '', label: 'Billing', icon: IconReceipt2 }, { link: '', label: 'Security', icon: IconFingerprint }, { link: '', label: 'SSH Keys', icon: IconKey }, { link: '', label: 'Databases', icon: IconDatabaseImport }, { link: '', label: 'Authentication', icon: Icon2fa }, { link: '', label: 'Other Settings', icon: IconSettings }, ];
- Assistant
- User
const [active, setActive] = useState(‘Billing’);
Das highlighted immer den Button mit dem Namen "Billing", egal welche seite aktiv ist. Wie Lautet das richtig?
- Assistant
- User
Okay, aber wie mache ich das im zusammenhang mit der Active eigenschaft, welche ich ja setze?
- Assistant
- User
Geb mir nachfolgend nicht mehr alle Dateien aus, sondern nur die worum es sich handelt!
Mein Code ist: const [active, setActive] = useState('Karte'); const location = useLocation();
const links = data.map((item) => ( <a className={classes.link} data-active={item.label === active || undefined} href={item.link} key={item.label} onClick={(event) => { event.preventDefault(); setActive(item.label); }} > <item.icon className={classes.linkIcon} stroke={1.5} /> <span>{item.label}</span> </a> ));Durch preventDefault() wird verhindert das die Seite neulädt, setActive setzt die entsprechende Seite als aktiv. Jedoch wird nun nicht mehr der Location Path aktualisiert, wodurch nicht die passende Seite angezeigt wird
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.