|
110 | 110 | gap: $space-md; |
111 | 111 | } |
112 | 112 |
|
113 | | -// Theme toggle |
| 113 | +// Theme toggle slider |
114 | 114 | .theme-toggle { |
115 | 115 | background: none; |
116 | | - border: 2px solid var(--color-border); |
117 | | - border-radius: 50%; |
118 | | - width: 38px; |
119 | | - height: 38px; |
| 116 | + border: none; |
| 117 | + padding: 0; |
| 118 | + cursor: pointer; |
| 119 | + line-height: 1; |
120 | 120 | display: flex; |
121 | 121 | align-items: center; |
122 | | - justify-content: center; |
123 | | - cursor: pointer; |
124 | | - color: var(--color-text-muted); |
125 | | - transition: all $transition-normal; |
126 | | - font-size: 1.1rem; |
| 122 | +} |
127 | 123 |
|
128 | | - &:hover { |
129 | | - border-color: var(--color-primary); |
130 | | - color: var(--color-primary); |
131 | | - transform: rotate(20deg); |
| 124 | +.theme-toggle__track { |
| 125 | + position: relative; |
| 126 | + width: 56px; |
| 127 | + height: 28px; |
| 128 | + background: #d1e9eb; |
| 129 | + border-radius: 999px; |
| 130 | + display: flex; |
| 131 | + align-items: center; |
| 132 | + justify-content: space-between; |
| 133 | + padding: 0 6px; |
| 134 | + transition: background-color 0.3s ease; |
| 135 | + box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); |
| 136 | +} |
| 137 | + |
| 138 | +.theme-toggle__icon { |
| 139 | + font-size: 0.85rem; |
| 140 | + line-height: 1; |
| 141 | + z-index: 1; |
| 142 | + transition: opacity 0.3s ease; |
| 143 | + user-select: none; |
| 144 | +} |
| 145 | + |
| 146 | +.theme-toggle__icon--sun { |
| 147 | + opacity: 1; |
| 148 | +} |
| 149 | + |
| 150 | +.theme-toggle__icon--moon { |
| 151 | + opacity: 0.4; |
| 152 | +} |
| 153 | + |
| 154 | +.theme-toggle__thumb { |
| 155 | + position: absolute; |
| 156 | + top: 3px; |
| 157 | + left: 3px; |
| 158 | + width: 22px; |
| 159 | + height: 22px; |
| 160 | + background: #fff; |
| 161 | + border-radius: 50%; |
| 162 | + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); |
| 163 | + transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); |
| 164 | +} |
| 165 | + |
| 166 | +.theme-toggle:hover .theme-toggle__thumb { |
| 167 | + box-shadow: 0 2px 8px rgba(70, 191, 198, 0.4); |
| 168 | +} |
| 169 | + |
| 170 | +[data-theme="dark"] { |
| 171 | + .theme-toggle__track { |
| 172 | + background: #2a3a4a; |
132 | 173 | } |
133 | 174 |
|
134 | | - .icon-sun, |
135 | | - .icon-moon { |
136 | | - transition: opacity $transition-fast, transform $transition-normal; |
| 175 | + .theme-toggle__icon--sun { |
| 176 | + opacity: 0.4; |
137 | 177 | } |
138 | 178 |
|
139 | | - .icon-moon { display: none; } |
140 | | -} |
| 179 | + .theme-toggle__icon--moon { |
| 180 | + opacity: 1; |
| 181 | + } |
141 | 182 |
|
142 | | -[data-theme="dark"] .theme-toggle { |
143 | | - .icon-sun { display: none; } |
144 | | - .icon-moon { display: block; } |
| 183 | + .theme-toggle__thumb { |
| 184 | + transform: translateX(28px); |
| 185 | + background: #1a2636; |
| 186 | + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(109, 213, 219, 0.3); |
| 187 | + } |
145 | 188 | } |
146 | 189 |
|
147 | 190 | // GitHub link |
|
0 commit comments