feat: add themed sidebar logo
This commit is contained in:
@@ -87,6 +87,7 @@ const timelineSelection = mustGet("timeline-selection");
|
|||||||
const timelineBrush = mustGet("timeline-brush");
|
const timelineBrush = mustGet("timeline-brush");
|
||||||
const themeToggle = mustGet("theme-toggle");
|
const themeToggle = mustGet("theme-toggle");
|
||||||
const themeToggleIcon = mustGet("theme-toggle-icon");
|
const themeToggleIcon = mustGet("theme-toggle-icon");
|
||||||
|
const panelLogo = mustGet("panel-logo");
|
||||||
const sidebarCollapseButton = mustGet("sidebar-collapse");
|
const sidebarCollapseButton = mustGet("sidebar-collapse");
|
||||||
const sidebarCollapseIcon = mustGet("sidebar-collapse-icon");
|
const sidebarCollapseIcon = mustGet("sidebar-collapse-icon");
|
||||||
const timelineCollapseButton = mustGet("timeline-collapse");
|
const timelineCollapseButton = mustGet("timeline-collapse");
|
||||||
@@ -203,6 +204,10 @@ async function createThumbnailObjectUrl(blob) {
|
|||||||
return URL.createObjectURL(thumbnailBlob);
|
return URL.createObjectURL(thumbnailBlob);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setBrandLogo(theme) {
|
||||||
|
panelLogo.src = theme === "dark" ? "/assets/logo-dark.svg" : "/assets/logo-light.svg";
|
||||||
|
}
|
||||||
|
|
||||||
function setTheme(theme, persist = true) {
|
function setTheme(theme, persist = true) {
|
||||||
const resolvedTheme = theme === "light" ? "light" : "dark";
|
const resolvedTheme = theme === "light" ? "light" : "dark";
|
||||||
document.body.dataset.theme = resolvedTheme;
|
document.body.dataset.theme = resolvedTheme;
|
||||||
@@ -210,6 +215,7 @@ function setTheme(theme, persist = true) {
|
|||||||
localStorage.setItem("theme", resolvedTheme);
|
localStorage.setItem("theme", resolvedTheme);
|
||||||
}
|
}
|
||||||
setMapTheme(resolvedTheme);
|
setMapTheme(resolvedTheme);
|
||||||
|
setBrandLogo(resolvedTheme);
|
||||||
|
|
||||||
if (resolvedTheme === "dark") {
|
if (resolvedTheme === "dark") {
|
||||||
themeToggle.setAttribute("aria-label", "Switch to light mode");
|
themeToggle.setAttribute("aria-label", "Switch to light mode");
|
||||||
|
|||||||
@@ -215,6 +215,10 @@ export const APP_STYLES = ` :root {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aside.sidebar-collapsed .panel-logo {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@@ -274,10 +278,18 @@ export const APP_STYLES = ` :root {
|
|||||||
.panel-toolbar {
|
.panel-toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.panel-logo {
|
||||||
|
display: block;
|
||||||
|
width: min(150px, calc(100% - 40px));
|
||||||
|
height: auto;
|
||||||
|
object-fit: contain;
|
||||||
|
flex: 0 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
.theme-toggle {
|
.theme-toggle {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
|||||||
@@ -49,6 +49,14 @@ ${APP_STYLES}
|
|||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
<img
|
||||||
|
class="panel-logo"
|
||||||
|
id="panel-logo"
|
||||||
|
src="/assets/logo-light.svg"
|
||||||
|
alt="mapix"
|
||||||
|
width="156"
|
||||||
|
height="66"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<label>
|
<label>
|
||||||
Share URL
|
Share URL
|
||||||
|
|||||||
Reference in New Issue
Block a user