Livio Spring 3b59b5cb1a
fix(login): correctly render logo based on theme mode (#8355)
# Which Problems Are Solved

The initial load of the login UI with dark mode preference
(prefers-color-scheme: dark) first rendered the logo configured for
light mode. Also switching from dark to light or vice versa would result
in the same behavior.
This was due to a mixed logic of server (based on cookie) and client
(prefers-color-scheme and cookie) deciding which mode to render.

# How the Problems Are Solved

- Since the main logic of which mode to use (`prefers-color-scheme`) can
only be achieve client side, both logos will be served in the HTML and
either will be rendered based on CSS.

# Additional Changes

None

# Additional Context

- closes #2085
2024-07-25 07:38:36 +00:00

18 lines
768 B
HTML

{{define "header"}}
<header class="lgn-header">
{{ if hasCustomPolicy .LabelPolicy }}
{{ $logoDark := customLogoResource .PrivateLabelingOrgID .LabelPolicy true }}
{{ $logoLight := customLogoResource .PrivateLabelingOrgID .LabelPolicy false }}
{{if $logoDark}}
<img class="lgn-logo lgn-logo-dark" src="{{$logoDark}}" alt="Logo">
{{end}}
{{if $logoLight}}
<img class="lgn-logo lgn-logo-light" src="{{$logoLight}}" alt="Logo">
{{end}}
{{ else }}
<img class="lgn-logo lgn-logo-dark" src="{{ resourceThemeUrl "logo-light.svg" .Theme }}" alt="Logo">
<img class="lgn-logo lgn-logo-light" src="{{ resourceThemeUrl "logo-dark.svg" .Theme }}" alt="Logo">
{{end}}
</header>
{{end}}