UX. refactor: simplify AdminPageNav component by removing unused hooks and improving styling
Deploy Development / deploy (push) Successful in 35s
Test Suite / pytest-backend (push) Successful in 6s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 28s
Deploy Development / deploy (push) Successful in 35s
Test Suite / pytest-backend (push) Successful in 6s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 28s
- Removed the useLocation hook as it was unnecessary for the component's functionality. - Updated the navigation styling to use CSS classes instead of inline styles, enhancing maintainability and readability. - Improved accessibility by adding aria-labels to navigation elements.
This commit is contained in:
1 parent
2007f3f659
commit
14884e6e55
6 files changed
+255
-221
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { NavLink, useLocation } from 'react-router-dom'
|
||||
import { NavLink } from 'react-router-dom'
|
||||
import { TreePine, FolderTree, Download, Grid3x3, Users } from 'lucide-react'
|
||||
|
||||
/**
|
||||
@@ -6,8 +6,6 @@ import { TreePine, FolderTree, Download, Grid3x3, Users } from 'lucide-react'
|
||||
* Wechselt zwischen verschiedenen Admin-Seiten
|
||||
*/
|
||||
export default function AdminPageNav() {
|
||||
const location = useLocation()
|
||||
|
||||
const pages = [
|
||||
{ to: '/admin/hierarchy', label: 'Hierarchie', icon: TreePine },
|
||||
{ to: '/admin/users', label: 'Nutzer', icon: Users },
|
||||
@@ -17,51 +15,18 @@ export default function AdminPageNav() {
|
||||
]
|
||||
|
||||
return (
|
||||
<nav style={{
|
||||
display: 'flex',
|
||||
gap: '8px',
|
||||
borderBottom: '2px solid var(--border)',
|
||||
marginBottom: '24px',
|
||||
flexWrap: 'wrap'
|
||||
}}>
|
||||
{pages.map(page => {
|
||||
<nav className="admin-top-nav" aria-label="Administration">
|
||||
{pages.map((page) => {
|
||||
const Icon = page.icon
|
||||
const isActive = location.pathname === page.to
|
||||
|
||||
return (
|
||||
<NavLink
|
||||
key={page.to}
|
||||
to={page.to}
|
||||
style={{
|
||||
padding: '12px 20px',
|
||||
background: 'transparent',
|
||||
border: 'none',
|
||||
borderBottom: '3px solid transparent',
|
||||
cursor: 'pointer',
|
||||
fontSize: '16px',
|
||||
fontWeight: 500,
|
||||
color: isActive ? 'var(--accent)' : 'var(--text2)',
|
||||
borderBottomColor: isActive ? 'var(--accent)' : 'transparent',
|
||||
textDecoration: 'none',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
transition: 'all 0.2s'
|
||||
}}
|
||||
onMouseEnter={(e) => {
|
||||
if (!isActive) {
|
||||
e.currentTarget.style.color = 'var(--text1)'
|
||||
e.currentTarget.style.background = 'var(--surface2)'
|
||||
}
|
||||
}}
|
||||
onMouseLeave={(e) => {
|
||||
if (!isActive) {
|
||||
e.currentTarget.style.color = 'var(--text2)'
|
||||
e.currentTarget.style.background = 'transparent'
|
||||
}
|
||||
}}
|
||||
className={({ isActive }) =>
|
||||
'admin-top-nav__link' + (isActive ? ' admin-top-nav__link--active' : '')
|
||||
}
|
||||
>
|
||||
<Icon size={18} />
|
||||
<Icon size={18} strokeWidth={2} aria-hidden />
|
||||
<span>{page.label}</span>
|
||||
</NavLink>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user