refactor: натравил форматтер на весь фронт
This commit is contained in:
@@ -7,7 +7,12 @@ import AppIcon from '@/components/ui/AppIcon.vue'
|
||||
const auth = useAuthStore()
|
||||
const route = useRoute()
|
||||
|
||||
interface NavItem { label: string; icon: string; to: string; roles: string[] }
|
||||
interface NavItem {
|
||||
label: string
|
||||
icon: string
|
||||
to: string
|
||||
roles: string[]
|
||||
}
|
||||
|
||||
const navItems: NavItem[] = [
|
||||
{ label: 'Главная', icon: 'home', to: '/', roles: ['student'] },
|
||||
@@ -25,7 +30,7 @@ const navItems: NavItem[] = [
|
||||
]
|
||||
|
||||
const visible = computed(() =>
|
||||
navItems.filter(n => auth.user && n.roles.includes(auth.user.activeRole))
|
||||
navItems.filter((n) => auth.user && n.roles.includes(auth.user.activeRole)),
|
||||
)
|
||||
|
||||
function isActive(to: string) {
|
||||
@@ -40,10 +45,10 @@ function isActive(to: string) {
|
||||
<RouterLink
|
||||
v-for="item in visible"
|
||||
:key="item.to + item.label"
|
||||
:to="item.to"
|
||||
class="nav-item"
|
||||
:class="{ active: isActive(item.to) }"
|
||||
>
|
||||
:to="item.to"
|
||||
class="nav-item"
|
||||
:class="{ active: isActive(item.to) }"
|
||||
>
|
||||
<AppIcon class="nav-icon" :icon="item.icon" :size="17" />
|
||||
<span class="nav-label">{{ item.label }}</span>
|
||||
</RouterLink>
|
||||
@@ -101,7 +106,10 @@ function isActive(to: string) {
|
||||
font-weight: 700;
|
||||
box-shadow: 0 2px 8px var(--color-primary-a12);
|
||||
}
|
||||
.nav-icon { flex-shrink: 0; color: currentColor; }
|
||||
.nav-icon {
|
||||
flex-shrink: 0;
|
||||
color: currentColor;
|
||||
}
|
||||
.sidebar-footer {
|
||||
padding: 10px 18px 8px;
|
||||
display: flex;
|
||||
@@ -113,5 +121,9 @@ function isActive(to: string) {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) { .sidebar { display: none; } }
|
||||
@media (max-width: 768px) {
|
||||
.sidebar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user