CreatorCenter_OOIN/src/styles/sidebar.scss

185 lines
4.2 KiB
SCSS

// @import 'custom-theme.scss';
// 导入变量
@import './variables';
.sidebar {
width: 220px;
min-height: 100vh;
position: fixed;
left: 0;
top: 0;
bottom: 0;
box-shadow: none;
z-index: 1000;
transition: all 0.3s ease;
overflow-y: auto;
background: $primary-100;
// Collapsed sidebar style
&.sidebar-collapsed {
width: 70px;
.sidebar-icon {
margin-right: 0 !important;
}
.accordion-button::after {
display: none;
}
.nav-link {
justify-content: center;
padding: 0.75rem 0.5rem;
}
.accordion-button {
justify-content: center;
padding: 0.75rem 0.5rem;
}
.sidebar-header {
justify-content: center;
padding: 1rem 0.5rem !important;
}
}
.sidebar-header {
}
.sidebar-nav {
padding: 1rem 0;
.nav-link {
padding: 0.75rem 1rem;
color: $zinc-600; // neutral-600
font-size: 1rem;
border-radius: 0;
display: flex;
align-items: center;
text-decoration: none;
font-weight: 500;
border-left: 4px solid transparent;
&:hover {
text-decoration: none;
color: var(--bs-primary);
background-color: rgba(var(--bs-primary-rgb), 0.05);
}
&.active {
color: var(--bs-primary);
font-weight: 600;
border-left: 4px solid var(--bs-primary);
}
.sidebar-icon {
display: flex;
align-items: center;
justify-content: center;
}
}
}
.sidebar-accordion {
width: 100%;
.accordion-item {
background-color: transparent;
}
.accordion-header {
.accordion-button {
padding: 0.75rem 1rem;
background-color: transparent;
color: $zinc-600; // neutral-600
font-size: 1rem;
box-shadow: none;
font-weight: 500;
border-left: 4px solid transparent;
&:not(.collapsed) {
color: var(--bs-primary);
background-color: rgba(var(--bs-primary-rgb), 0.05);
font-weight: 500;
}
&:hover {
color: var(--bs-primary);
background-color: rgba(var(--bs-primary-rgb), 0.05);
}
&:focus {
box-shadow: none;
border-color: transparent;
}
&::after {
width: 1rem;
height: 1rem;
background-size: 1rem;
}
&.active {
font-weight: 600;
color: var(--bs-primary);
}
}
&.collapsed-header .accordion-button {
justify-content: center;
padding: 0.75rem 0.5rem;
&::after {
display: none;
}
}
}
.sidebar-submenu {
.nav-link {
padding: 0.5rem 1rem;
padding-left: 2rem;
}
}
}
}
// Adjust main content when sidebar is present
.main-content {
padding: 1.5rem;
margin: 1rem;
margin-left: 220px;
height: calc(100vh - 2rem);
transition: all 0.3s ease;
background: #f8f9fa;
border-radius: 8px;
}
// Collapsed sidebar adjustments
.sidebar-collapsed + .main-content {
margin-left: 70px;
}
// Responsive sidebar for mobile
@media (max-width: 768px) {
.sidebar {
width: 0;
overflow: hidden;
}
.main-content {
margin-left: 70px;
}
}
// Toggle button for mobile
.sidebar-toggle {
position: fixed;
top: 1rem;
left: 1rem;
z-index: 1100;
display: none;
@media (max-width: 768px) {
display: block;
}
}