Add dark logos (#903)

Co-authored-by: Emruz Hossain <hossainemruz@gmail.com>
This commit is contained in:
Bernat Borràs Civil 2024-03-10 11:02:51 +01:00 committed by GitHub
parent 803821d7e8
commit 36e3e4c09c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 38 additions and 8 deletions

View file

@ -39,6 +39,8 @@ window.addEventListener('load', async () => {
// save preference to local storage // save preference to local storage
saveScheme(newScheme) saveScheme(newScheme)
setImages(newScheme)
} }
setScheme(loadScheme()) setScheme(loadScheme())
@ -50,3 +52,19 @@ window.addEventListener('load', async () => {
}) })
}) })
}) })
function setImages(newScheme) {
const els = Array.from(document.getElementsByClassName('logo-holder'));
for (const el of els) {
const light = el.querySelector('.light-logo');
const dark = el.querySelector('.dark-logo');
if (newScheme === "dark" && dark !== null) {
if (light !== null) light.style.display = 'none'
dark.style.display = 'inline'
}
else {
if (light !== null) light.style.display = 'inline'
if (dark !== null) dark.style.display = 'none'
}
}
}

View file

@ -33,9 +33,13 @@
<div class="degree-info card"> <div class="degree-info card">
{{ $logoImage:= resources.Get .institution.logo}} {{ $logoImage:= resources.Get .institution.logo}}
{{ $darkLogoImage:= resources.Get .institution.darkLogo}}
{{ if $logoImage }} {{ if $logoImage }}
<div class="logo-holder"> <div class="logo-holder">
<img class="company-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" /> <img class="company-logo light-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" />
{{ if $darkLogoImage }}
<img class="company-logo dark-logo" src="{{ $darkLogoImage.RelPermalink }}" alt="{{ .name }}" />
{{ end }}
</div> </div>
{{ end }} {{ end }}

View file

@ -33,9 +33,13 @@
<div class="degree-info card"> <div class="degree-info card">
{{ $logoImage:= resources.Get .institution.logo}} {{ $logoImage:= resources.Get .institution.logo}}
{{ $darkLogoImage:= resources.Get .institution.darkLogo}}
{{ if $logoImage }} {{ if $logoImage }}
<div class="logo-holder"> <div class="logo-holder">
<img class="company-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" /> <img class="company-logo light-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" />
{{ if $darkLogoImage }}
<img class="company-logo dark-logo" src="{{ $darkLogoImage.RelPermalink }}" alt="{{ .name }}" />
{{ end }}
</div> </div>
{{ end }} {{ end }}

View file

@ -1,11 +1,15 @@
<div class="col-10 col-lg-8"> <div class="col-10 col-lg-8">
<div class="experience-entry-heading"> <div class="experience-entry-heading">
{{ $logoImage:= resources.Get .company.logo}} {{ $logoImage:= resources.Get .company.logo}}
{{ if $logoImage }} {{ $darkLogoImage:= resources.Get .company.darkLogo}}
<div class="logo-holder"> {{ if $logoImage }}
<img class="company-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" /> <div class="logo-holder">
</div> <img class="company-logo light-logo" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" />
{{ if $darkLogoImage }}
<img class="company-logo dark-logo" src="{{ $darkLogoImage.RelPermalink }}" alt="{{ .name }}" />
{{ end }} {{ end }}
</div>
{{ end }}
<!-- Total experience duration on a company is time between the starting date of the oldest position and ending date of most recent position --> <!-- Total experience duration on a company is time between the starting date of the oldest position and ending date of most recent position -->
{{ $oldestPosition := index (last 1 .positions) 0}} {{ $oldestPosition := index (last 1 .positions) 0}}
{{ $mostRecentPosition := index (first 1 .positions) 0}} {{ $mostRecentPosition := index (first 1 .positions) 0}}