feat: добавлена светлая тема с кнопкой переключения
This commit is contained in:
@@ -29,6 +29,46 @@
|
|||||||
--transition: 0.2s ease;
|
--transition: 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===== Light Theme ===== */
|
||||||
|
[data-theme="light"] {
|
||||||
|
--bg-primary: #e8eaef;
|
||||||
|
--bg-sidebar: rgba(255, 255, 255, 0.88);
|
||||||
|
--bg-card: rgba(255, 255, 255, 0.95);
|
||||||
|
--bg-card-border: rgba(0, 0, 0, 0.22);
|
||||||
|
--bg-input: rgba(0, 0, 0, 0.08);
|
||||||
|
--bg-input-focus: rgba(0, 0, 0, 0.12);
|
||||||
|
--bg-hover: rgba(0, 0, 0, 0.08);
|
||||||
|
--text-primary: #0f172a;
|
||||||
|
--text-secondary: #374151;
|
||||||
|
--text-placeholder: #6b7280;
|
||||||
|
--accent: #6366f1;
|
||||||
|
--accent-hover: #4f46e5;
|
||||||
|
--accent-glow: rgba(99, 102, 241, 0.25);
|
||||||
|
--error: #dc2626;
|
||||||
|
--success: #16a34a;
|
||||||
|
--warning: #d97706;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="light"] .form-group select option,
|
||||||
|
[data-theme="light"] .filter-row select option {
|
||||||
|
background: #fff;
|
||||||
|
color: #1a1a2e;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="light"] .nav-item.active {
|
||||||
|
background: rgba(99, 102, 241, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="light"] .form-group input,
|
||||||
|
[data-theme="light"] .form-group select,
|
||||||
|
[data-theme="light"] .filter-row select {
|
||||||
|
border-color: rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="light"] tbody td {
|
||||||
|
border-bottom-color: rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
@@ -40,6 +80,7 @@ body {
|
|||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
transition: background 0.4s ease, color 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== Sidebar ===== */
|
/* ===== Sidebar ===== */
|
||||||
@@ -55,6 +96,7 @@ body {
|
|||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
transition: background 0.4s ease, border-color 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-header {
|
.sidebar-header {
|
||||||
@@ -135,12 +177,18 @@ body {
|
|||||||
.topbar {
|
.topbar {
|
||||||
padding: 1.5rem 2rem;
|
padding: 1.5rem 2rem;
|
||||||
border-bottom: 1px solid var(--bg-card-border);
|
border-bottom: 1px solid var(--bg-card-border);
|
||||||
|
transition: border-color 0.4s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topbar h1 {
|
.topbar h1 {
|
||||||
font-size: 1.3rem;
|
font-size: 1.3rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
letter-spacing: -0.02em;
|
letter-spacing: -0.02em;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
@@ -156,16 +204,16 @@ body {
|
|||||||
border: 1px solid var(--bg-card-border);
|
border: 1px solid var(--bg-card-border);
|
||||||
border-radius: var(--radius-md);
|
border-radius: var(--radius-md);
|
||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
|
transition: background 0.4s ease, border-color 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card h2 {
|
.card h2 {
|
||||||
font-size: 1rem;
|
font-size: 0.8rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
font-size: 0.8rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== Create Form ===== */
|
/* ===== Create Form ===== */
|
||||||
@@ -462,6 +510,44 @@ tbody tr:hover {
|
|||||||
backdrop-filter: blur(2px);
|
backdrop-filter: blur(2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===== Theme Toggle Button ===== */
|
||||||
|
.theme-toggle {
|
||||||
|
width: 38px;
|
||||||
|
height: 38px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--bg-input);
|
||||||
|
border: 1px solid var(--bg-card-border);
|
||||||
|
color: var(--text-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle svg {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
transition: transform 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
box-shadow: 0 4px 16px var(--accent-glow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle:active {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle--fixed {
|
||||||
|
position: fixed;
|
||||||
|
top: 1.25rem;
|
||||||
|
right: 1.25rem;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
/* ===== Responsive ===== */
|
/* ===== Responsive ===== */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.sidebar {
|
.sidebar {
|
||||||
|
|||||||
@@ -227,6 +227,7 @@
|
|||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<script src="/theme-toggle.js"></script>
|
||||||
<script src="admin.js"></script>
|
<script src="admin.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<script src="theme-toggle.js"></script>
|
||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -13,14 +13,37 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--bg-primary: #0f0f1a;
|
||||||
|
--text-primary: #f0f0f5;
|
||||||
|
--text-secondary: #9ca3af;
|
||||||
|
--accent-hover: #818cf8;
|
||||||
|
--bg-card: rgba(255, 255, 255, 0.05);
|
||||||
|
--bg-card-border: rgba(255, 255, 255, 0.08);
|
||||||
|
--bg-input: rgba(255, 255, 255, 0.06);
|
||||||
|
--accent-glow: rgba(99, 102, 241, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="light"] {
|
||||||
|
--bg-primary: #e8eaef;
|
||||||
|
--text-primary: #0f172a;
|
||||||
|
--text-secondary: #374151;
|
||||||
|
--accent-hover: #4f46e5;
|
||||||
|
--bg-card: rgba(255, 255, 255, 0.95);
|
||||||
|
--bg-card-border: rgba(0, 0, 0, 0.22);
|
||||||
|
--bg-input: rgba(0, 0, 0, 0.08);
|
||||||
|
--accent-glow: rgba(99, 102, 241, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'Inter', sans-serif;
|
font-family: 'Inter', sans-serif;
|
||||||
background: #0f0f1a;
|
background: var(--bg-primary);
|
||||||
color: #f0f0f5;
|
color: var(--text-primary);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
transition: background 0.4s ease, color 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder {
|
.placeholder {
|
||||||
@@ -33,18 +56,57 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.placeholder p {
|
.placeholder p {
|
||||||
color: #9ca3af;
|
color: var(--text-secondary);
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder a {
|
.placeholder a {
|
||||||
color: #818cf8;
|
color: var(--accent-hover);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder a:hover {
|
.placeholder a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Theme Toggle */
|
||||||
|
.theme-toggle {
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--bg-card-border);
|
||||||
|
color: var(--text-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle svg {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
transition: transform 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
box-shadow: 0 4px 16px var(--accent-glow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle:active {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle--fixed {
|
||||||
|
position: fixed;
|
||||||
|
top: 1.25rem;
|
||||||
|
right: 1.25rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -52,8 +114,10 @@
|
|||||||
<div class="placeholder">
|
<div class="placeholder">
|
||||||
<h1>Панель студента</h1>
|
<h1>Панель студента</h1>
|
||||||
<p>Раздел в разработке</p>
|
<p>Раздел в разработке</p>
|
||||||
<a href="/" onclick="localStorage.clear()">Выйти</a>
|
<a href="/" onclick="localStorage.removeItem('token'); localStorage.removeItem('role')">Выйти</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="/theme-toggle.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -27,6 +27,33 @@
|
|||||||
--transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
--transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===== Light Theme ===== */
|
||||||
|
[data-theme="light"] {
|
||||||
|
--bg-primary: #e8eaef;
|
||||||
|
--bg-card: rgba(255, 255, 255, 0.95);
|
||||||
|
--bg-card-border: rgba(0, 0, 0, 0.22);
|
||||||
|
--bg-input: rgba(0, 0, 0, 0.08);
|
||||||
|
--bg-input-focus: rgba(0, 0, 0, 0.12);
|
||||||
|
--text-primary: #0f172a;
|
||||||
|
--text-secondary: #374151;
|
||||||
|
--text-placeholder: #6b7280;
|
||||||
|
--accent: #6366f1;
|
||||||
|
--accent-hover: #4f46e5;
|
||||||
|
--accent-glow: rgba(99, 102, 241, 0.25);
|
||||||
|
--error: #dc2626;
|
||||||
|
--success: #16a34a;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="light"] .shape {
|
||||||
|
opacity: 0.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="light"] .login-card {
|
||||||
|
box-shadow:
|
||||||
|
0 8px 32px rgba(0, 0, 0, 0.08),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
@@ -42,6 +69,7 @@ body {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
transition: background 0.4s ease, color 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== Animated Background ===== */
|
/* ===== Animated Background ===== */
|
||||||
@@ -58,6 +86,7 @@ body {
|
|||||||
filter: blur(80px);
|
filter: blur(80px);
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
animation: float 20s ease-in-out infinite;
|
animation: float 20s ease-in-out infinite;
|
||||||
|
transition: opacity 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shape-1 {
|
.shape-1 {
|
||||||
@@ -89,10 +118,23 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes float {
|
@keyframes float {
|
||||||
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
||||||
25% { transform: translate(30px, -40px) scale(1.05); }
|
0%,
|
||||||
50% { transform: translate(-20px, 20px) scale(0.95); }
|
100% {
|
||||||
75% { transform: translate(15px, 35px) scale(1.03); }
|
transform: translate(0, 0) scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
25% {
|
||||||
|
transform: translate(30px, -40px) scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
transform: translate(-20px, 20px) scale(0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
75% {
|
||||||
|
transform: translate(15px, 35px) scale(1.03);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== Login Container ===== */
|
/* ===== Login Container ===== */
|
||||||
@@ -110,6 +152,7 @@ body {
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(24px);
|
transform: translateY(24px);
|
||||||
}
|
}
|
||||||
|
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
@@ -127,6 +170,7 @@ body {
|
|||||||
box-shadow:
|
box-shadow:
|
||||||
0 8px 32px rgba(0, 0, 0, 0.3),
|
0 8px 32px rgba(0, 0, 0, 0.3),
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
||||||
|
transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== Header ===== */
|
/* ===== Header ===== */
|
||||||
@@ -142,8 +186,15 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse-glow {
|
@keyframes pulse-glow {
|
||||||
0%, 100% { filter: drop-shadow(0 0 6px var(--accent-glow)); }
|
|
||||||
50% { filter: drop-shadow(0 0 18px var(--accent-glow)); }
|
0%,
|
||||||
|
100% {
|
||||||
|
filter: drop-shadow(0 0 6px var(--accent-glow));
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
filter: drop-shadow(0 0 18px var(--accent-glow));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-header h1 {
|
.login-header h1 {
|
||||||
@@ -214,8 +265,8 @@ body {
|
|||||||
box-shadow: 0 0 0 3px var(--accent-glow);
|
box-shadow: 0 0 0 3px var(--accent-glow);
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-wrapper input:focus ~ .input-icon,
|
.input-wrapper input:focus~.input-icon,
|
||||||
.input-wrapper input:focus + .input-icon {
|
.input-wrapper input:focus+.input-icon {
|
||||||
color: var(--accent);
|
color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +371,9 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
to { transform: rotate(360deg); }
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== Input Error State ===== */
|
/* ===== Input Error State ===== */
|
||||||
@@ -329,6 +382,47 @@ body {
|
|||||||
box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
|
box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===== Theme Toggle Button ===== */
|
||||||
|
.theme-toggle {
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--bg-card-border);
|
||||||
|
color: var(--text-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
z-index: 100;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle svg {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
transition: transform 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
box-shadow: 0 4px 16px var(--accent-glow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle:active {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle--fixed {
|
||||||
|
position: fixed;
|
||||||
|
top: 1.25rem;
|
||||||
|
right: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
/* ===== Responsive ===== */
|
/* ===== Responsive ===== */
|
||||||
@media (max-width: 480px) {
|
@media (max-width: 480px) {
|
||||||
.login-card {
|
.login-card {
|
||||||
@@ -338,4 +432,16 @@ body {
|
|||||||
.login-header h1 {
|
.login-header h1 {
|
||||||
font-size: 1.3rem;
|
font-size: 1.3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.theme-toggle--fixed {
|
||||||
|
top: 0.75rem;
|
||||||
|
right: 0.75rem;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle--fixed svg {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -13,14 +13,37 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--bg-primary: #0f0f1a;
|
||||||
|
--text-primary: #f0f0f5;
|
||||||
|
--text-secondary: #9ca3af;
|
||||||
|
--accent-hover: #818cf8;
|
||||||
|
--bg-card: rgba(255, 255, 255, 0.05);
|
||||||
|
--bg-card-border: rgba(255, 255, 255, 0.08);
|
||||||
|
--bg-input: rgba(255, 255, 255, 0.06);
|
||||||
|
--accent-glow: rgba(99, 102, 241, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="light"] {
|
||||||
|
--bg-primary: #e8eaef;
|
||||||
|
--text-primary: #0f172a;
|
||||||
|
--text-secondary: #374151;
|
||||||
|
--accent-hover: #4f46e5;
|
||||||
|
--bg-card: rgba(255, 255, 255, 0.95);
|
||||||
|
--bg-card-border: rgba(0, 0, 0, 0.22);
|
||||||
|
--bg-input: rgba(0, 0, 0, 0.08);
|
||||||
|
--accent-glow: rgba(99, 102, 241, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'Inter', sans-serif;
|
font-family: 'Inter', sans-serif;
|
||||||
background: #0f0f1a;
|
background: var(--bg-primary);
|
||||||
color: #f0f0f5;
|
color: var(--text-primary);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
transition: background 0.4s ease, color 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder {
|
.placeholder {
|
||||||
@@ -33,18 +56,57 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.placeholder p {
|
.placeholder p {
|
||||||
color: #9ca3af;
|
color: var(--text-secondary);
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder a {
|
.placeholder a {
|
||||||
color: #818cf8;
|
color: var(--accent-hover);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder a:hover {
|
.placeholder a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Theme Toggle */
|
||||||
|
.theme-toggle {
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--bg-card-border);
|
||||||
|
color: var(--text-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle svg {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
transition: transform 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
box-shadow: 0 4px 16px var(--accent-glow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle:active {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-toggle--fixed {
|
||||||
|
position: fixed;
|
||||||
|
top: 1.25rem;
|
||||||
|
right: 1.25rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -52,8 +114,10 @@
|
|||||||
<div class="placeholder">
|
<div class="placeholder">
|
||||||
<h1>Панель преподавателя</h1>
|
<h1>Панель преподавателя</h1>
|
||||||
<p>Раздел в разработке</p>
|
<p>Раздел в разработке</p>
|
||||||
<a href="/" onclick="localStorage.clear()">Выйти</a>
|
<a href="/" onclick="localStorage.removeItem('token'); localStorage.removeItem('role')">Выйти</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="/theme-toggle.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
65
frontend/theme-toggle.js
Normal file
65
frontend/theme-toggle.js
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* Theme Toggle — shared across all pages.
|
||||||
|
* Reads/writes 'theme' key in localStorage.
|
||||||
|
* Injects an animated moon/sun button into the page.
|
||||||
|
*/
|
||||||
|
(() => {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const STORAGE_KEY = 'theme';
|
||||||
|
|
||||||
|
/* ---------- SVG icons ---------- */
|
||||||
|
const moonSVG = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79z"/></svg>`;
|
||||||
|
const sunSVG = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>`;
|
||||||
|
|
||||||
|
/* ---------- Apply saved theme BEFORE paint ---------- */
|
||||||
|
const saved = localStorage.getItem(STORAGE_KEY);
|
||||||
|
if (saved) {
|
||||||
|
document.documentElement.setAttribute('data-theme', saved);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Create button when DOM ready ---------- */
|
||||||
|
function init() {
|
||||||
|
const isDark = () => document.documentElement.getAttribute('data-theme') !== 'light';
|
||||||
|
|
||||||
|
const btn = document.createElement('button');
|
||||||
|
btn.className = 'theme-toggle';
|
||||||
|
btn.setAttribute('aria-label', 'Переключить тему');
|
||||||
|
btn.innerHTML = isDark() ? moonSVG : sunSVG;
|
||||||
|
|
||||||
|
btn.addEventListener('click', () => {
|
||||||
|
const goLight = isDark();
|
||||||
|
document.documentElement.setAttribute('data-theme', goLight ? 'light' : 'dark');
|
||||||
|
localStorage.setItem(STORAGE_KEY, goLight ? 'light' : 'dark');
|
||||||
|
|
||||||
|
/* Swap icon immediately and trigger a gentle rotate via CSS */
|
||||||
|
btn.innerHTML = goLight ? sunSVG : moonSVG;
|
||||||
|
const svg = btn.querySelector('svg');
|
||||||
|
svg.style.transition = 'none';
|
||||||
|
svg.style.transform = 'rotate(-90deg) scale(0.5)';
|
||||||
|
svg.style.opacity = '0';
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
svg.style.transition = 'transform 0.4s ease, opacity 0.3s ease';
|
||||||
|
svg.style.transform = 'rotate(0deg) scale(1)';
|
||||||
|
svg.style.opacity = '1';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Where to place the button */
|
||||||
|
const topbar = document.querySelector('.topbar');
|
||||||
|
if (topbar) {
|
||||||
|
/* Admin-style pages: insert into topbar (CSS handles flex layout) */
|
||||||
|
topbar.appendChild(btn);
|
||||||
|
} else {
|
||||||
|
/* Login / placeholder pages: fixed position */
|
||||||
|
btn.classList.add('theme-toggle--fixed');
|
||||||
|
document.body.appendChild(btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', init);
|
||||||
|
} else {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
})();
|
||||||
Reference in New Issue
Block a user