mirror of
https://github.com/zitadel/zitadel.git
synced 2025-05-08 04:46:46 +00:00
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
This commit is contained in:
parent
693e27b906
commit
3b59b5cb1a
@ -18,5 +18,12 @@ $lgn-header-margin: auto;
|
|||||||
max-width: 250px;
|
max-width: 250px;
|
||||||
max-height: 150px;
|
max-height: 150px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
|
|
||||||
|
.lgn-dark-theme &.lgn-logo-light {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.lgn-light-theme &.lgn-logo-dark {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
{{define "header"}}
|
{{define "header"}}
|
||||||
<header class="lgn-header">
|
<header class="lgn-header">
|
||||||
{{ if hasCustomPolicy .LabelPolicy }}
|
{{ if hasCustomPolicy .LabelPolicy }}
|
||||||
{{ $logo := customLogoResource .PrivateLabelingOrgID .LabelPolicy .DarkMode }}
|
{{ $logoDark := customLogoResource .PrivateLabelingOrgID .LabelPolicy true }}
|
||||||
{{if $logo}}
|
{{ $logoLight := customLogoResource .PrivateLabelingOrgID .LabelPolicy false }}
|
||||||
<img class="lgn-logo" src="{{$logo}}" alt="Logo">
|
{{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}}
|
{{end}}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
<img class="lgn-logo lgn-logo-dark" src="{{ resourceThemeUrl "logo-light.svg" .Theme }}" alt="Logo">
|
||||||
{{if .DarkMode }}
|
<img class="lgn-logo lgn-logo-light" src="{{ resourceThemeUrl "logo-dark.svg" .Theme }}" alt="Logo">
|
||||||
<img class="lgn-logo" src="{{ resourceThemeUrl "logo-light.svg" .Theme }}" alt="Logo">
|
|
||||||
{{else}}
|
|
||||||
<img class="lgn-logo" src="{{ resourceThemeUrl "logo-dark.svg" .Theme }}" alt="Logo">
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
{{end}}
|
||||||
</header>
|
</header>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user