Skip to content

Commit db8da4b

Browse files
authored
fix: Add aspect ratios for logo, operator logos and country flags (#252)
1 parent fd523b5 commit db8da4b

File tree

10 files changed

+22
-28
lines changed

10 files changed

+22
-28
lines changed

assets/sass/navigation.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
height: 4.4rem;
6565
padding: .2rem .4rem;
6666
align-self: center;
67+
aspect-ratio: 696 / 200;
6768
}
6869
}
6970

assets/sass/styles.scss

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,13 @@ img {
205205
h1 {
206206
margin-bottom: 0;
207207
}
208-
209-
img {
210-
max-height: 3.6rem;
211-
width: auto;
212-
border-radius: var(--border-radius-m);
213-
}
214208
}
215209

216210
&__content-header-title {
217211
display: flex;
218212
align-items: center;
219213
gap: 1.5rem;
214+
font-size: 3rem;
220215
}
221216

222217
&__news-image {
@@ -244,8 +239,9 @@ img {
244239
}
245240

246241
.a-flag {
247-
height: 2rem;
242+
height: 1.3em;
248243
width: auto;
244+
aspect-ratio: 1 / 1;
249245
}
250246

251247
button:not(:disabled) {
@@ -262,3 +258,10 @@ hr {
262258
details > summary {
263259
cursor: pointer;
264260
}
261+
262+
.a-operator-logo {
263+
height: 1.3em;
264+
width: auto;
265+
aspect-ratio: 120 / 50;
266+
border-radius: var(--border-radius-m)
267+
}

layouts/country/list.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ <h1 data-pagefind-meta="title">{{ .Title }}</h1>
66
{{ range .Pages }}
77
<a href="{{ .RelPermalink }}" class="o-list__link">
88
<div class="o-list__picture">
9-
{{ $object := replace .Path (printf "/%s/" .Page.Type) "" }}
10-
{{ partial "flag" $object }}
9+
{{ partial "flag" (dict "country" .File.ContentBaseName) }}
1110
</div>
1211
<div>
1312
{{ .Title }}

layouts/country/single.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
<div class="o-single__container content_with_heading">
88
<div class="o-single__content-header">
99
<div class="o-single__content-header-title">
10-
{{ $object := replace .Path (printf "/%s/" .Page.Type) "" }}
11-
{{ $image := resources.Get (printf "images/flags/%s.webp" $object) }}
12-
<img data-pagefind-meta="image[src]" src="{{ $image.RelPermalink }}" alt="" />
10+
{{ partial "flag" (dict "country" .File.ContentBaseName "pagefind" true) }}
1311
<h1 data-pagefind-meta="title">{{ .Title }}</h1>
1412
</div>
1513
{{ partial "updateDate.html" . }}

layouts/operator/list.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ <h1 data-pagefind-meta="title">{{ .Title }}</h1>
66
{{ range .Pages }}
77
<a href="{{ .RelPermalink }}" class="o-list__link">
88
<div class="o-list__picture">
9-
{{ $object := replace .Path (printf "/%s/" .Page.Type) "" }}
10-
{{ partial "logo" $object }}
9+
{{ partial "logo" (dict "operator" .File.ContentBaseName) }}
1110
</div>
1211
<div>
1312
{{ .Title }}

layouts/operator/single.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
<div class="o-single__container content_with_heading">
66
<div class="o-single__content-header">
77
<div class="o-single__content-header-title">
8-
{{ $object := replace .Path (printf "/%s/" .Page.Type) "" }}
9-
{{ $logo := resources.Get (printf "images/logos/%s.svg" $object) }}
10-
{{ if $logo }}
11-
<img data-pagefind-meta="image[src]" src="{{ $logo.RelPermalink }}" alt="" />
12-
{{ end }}
8+
{{ partial "logo" (dict "operator" .File.ContentBaseName "pagefind" true)}}
139
<h1 data-pagefind-meta="title">{{ .Title }}</h1>
1410
</div>
1511
{{ partial "updateDate.html" . }}

layouts/partials/flag.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{{ $image := resources.Get (printf "images/flags/%s.webp" .) }}
2-
<img class="a-flag" src="{{ $image.RelPermalink }}" alt="" />
1+
{{ $image := resources.Get (printf "images/flags/%s.webp" .country) }}
2+
<img class="a-flag" src="{{ $image.RelPermalink }}" alt="" {{ if .pagefind }}data-pagefind-meta="image[src]"{{ end }} />

layouts/partials/logo.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{ $logo := resources.Get (printf "/images/logos/%s.svg" .) }}
1+
{{ $logo := resources.Get (printf "/images/logos/%s.svg" .operator) }}
22
{{ if $logo }}
3-
<img src="{{ $logo.RelPermalink }}" alt="" style="height: 1.3em; width: auto" />
3+
<img src="{{ $logo.RelPermalink }}" alt="" class="a-operator-logo" {{ if .pagefind }}data-pagefind-meta="image[src]"{{ end }} />
44
{{ end }}

layouts/partials/related.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
<h3 id="o-related__title-{{ .identifier }}">{{ .title }}</h3>
55
<ul class="o-related__list" aria-labelledby="o-related__title-{{ .identifier }}">
66
{{ range $related }}
7-
{{ $object := replace .Path (printf "/%s/" .Page.Type) "" }}
87
<li class="o-related__item">
98
{{ $text := .LinkTitle }}
109
{{ if eq .Page.Type "news" }}
1110
{{ $text = print (partial "icon" "newspaper") $text }}
1211
{{ else if eq .Page.Type "operator" }}
13-
{{ $text = print (partial "logo" $object) $text }}
12+
{{ $text = print (partial "logo" (dict "operator" .File.ContentBaseName)) $text }}
1413
{{ else if eq .Page.Type "country" }}
15-
{{ $text = print (partial "flag" $object) $text }}
14+
{{ $text = print (partial "flag" (dict "country" .File.ContentBaseName)) $text }}
1615
{{ end }}
1716

1817
{{ partial "internal_link" (

layouts/partials/sidemenu.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
<li>
1010
<a href="{{ .RelPermalink }}" aria-label="{{ print (T "navigate-to-country") " " .LinkTitle }}">
1111
{{ partial "icon" "arrow_back" }}
12-
{{ $object := replace .Path (printf "/%s/" .Page.Type) "" }}
13-
<span class="o-aside__backlink-text">{{ partial "flag" $object }} {{ .LinkTitle }}</span>
12+
<span class="o-aside__backlink-text">{{ partial "flag" (dict "country" .File.ContentBaseName) }} {{ .LinkTitle }}</span>
1413
</a>
1514
</li>
1615
{{ end }}

0 commit comments

Comments
 (0)