SHA256
Связи: перенести переключатель версии в шапку
This commit is contained in:
@@ -25,14 +25,14 @@ function saveMode(mode) {
|
||||
|
||||
function createModeSwitcher(mode, navigate) {
|
||||
const label = document.createElement('label');
|
||||
label.className = 'network-version-switcher';
|
||||
label.innerHTML = '<span>Версия связей</span>';
|
||||
label.className = 'network-version-switcher network-version-switcher--topbar';
|
||||
label.innerHTML = '<span>Версия:</span>';
|
||||
|
||||
const select = document.createElement('select');
|
||||
select.setAttribute('aria-label', 'Версия экрана Связи');
|
||||
select.innerHTML = `
|
||||
<option value="legacy">Прежняя</option>
|
||||
<option value="modern">Новая</option>
|
||||
<option value="legacy">Версия 1</option>
|
||||
<option value="modern">Версия 2</option>
|
||||
`;
|
||||
select.value = mode;
|
||||
select.addEventListener('change', () => {
|
||||
@@ -49,6 +49,9 @@ export function render(context = {}) {
|
||||
const implementation = mode === 'legacy' ? legacyNetworkView : modernNetworkView;
|
||||
const screen = implementation.render(context);
|
||||
screen.classList.add(`network-screen--${mode}`);
|
||||
screen.prepend(createModeSwitcher(mode, context.navigate));
|
||||
const switcher = createModeSwitcher(mode, context.navigate);
|
||||
const topbarLeft = document.querySelector('#topbar-slot .topbar__left');
|
||||
if (topbarLeft) topbarLeft.append(switcher);
|
||||
else screen.prepend(switcher);
|
||||
return screen;
|
||||
}
|
||||
|
||||
@@ -12,30 +12,20 @@
|
||||
}
|
||||
|
||||
.network-version-switcher {
|
||||
position: absolute;
|
||||
top: calc(var(--topbar-height, 64px) + 8px);
|
||||
right: var(--page-gutter);
|
||||
z-index: 24;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 5px 8px;
|
||||
border: 1px solid color-mix(in srgb, var(--border-control) 82%, transparent);
|
||||
border-radius: 10px;
|
||||
background: color-mix(in srgb, var(--surface) 92%, transparent);
|
||||
box-shadow: 0 4px 16px color-mix(in srgb, #000 20%, transparent);
|
||||
color: var(--text-secondary);
|
||||
font-size: 11px;
|
||||
line-height: 1;
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.network-version-switcher select {
|
||||
max-width: 92px;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
background: transparent;
|
||||
max-width: 98px;
|
||||
padding: 3px 4px;
|
||||
border: 1px solid var(--border-control);
|
||||
border-radius: 7px;
|
||||
background: var(--surface);
|
||||
color: var(--text-primary);
|
||||
font: inherit;
|
||||
font-weight: 700;
|
||||
|
||||
Reference in New Issue
Block a user