Skip to content

Commit 5092d97

Browse files
Merge pull request #22325 from sarahsanders-docker/summary-bar-fix-field
fix: only render admin icon for keyword in summary bar
1 parent 30be50d commit 5092d97

File tree

1 file changed

+63
-58
lines changed

1 file changed

+63
-58
lines changed

layouts/shortcodes/summary-bar.html

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,74 +4,79 @@
44
{{ errorf "[summary-bar] invalid feature: %s %v" $featureName .Position }}
55
{{ end }}
66
{{ if $feature }}
7-
{{ $subscriptionIcons := dict
8-
"Business" "domain"
9-
"Team" "groups"
10-
"Pro" "person_add"
11-
"Personal" "person"
12-
"Available to all" "public"
13-
}}
14-
{{ $availabilityIcons := dict
15-
"Experimental" "science"
16-
"Beta" "bolt"
17-
"Early Access" "rocket_launch"
18-
"GA" "check_circle"
19-
"Retired" "package_2"
20-
}}
21-
{{ $requiresIcon := "browser_updated" }}
22-
{{ $forIcon := "admin_panel_settings" }}
7+
{{ $subscriptionIcons := dict
8+
"Business" "domain"
9+
"Team" "groups"
10+
"Pro" "person_add"
11+
"Personal" "person"
12+
"Available to all" "public"
13+
}}
14+
{{ $availabilityIcons := dict
15+
"Experimental" "science"
16+
"Beta" "bolt"
17+
"Early Access" "rocket_launch"
18+
"GA" "check_circle"
19+
"Retired" "package_2"
20+
}}
21+
{{ $requiresIcon := "browser_updated" }}
22+
{{ $forIcon := "admin_panel_settings" }}
2323

24-
<div class="flex flex-col bg-gray-light-200 bg-opacity-75 dark:bg-gray-dark-300 dark:bg-opacity-75 border-l-4 border-gray-light-200 px-4 py-1 my-1 not-prose">
25-
{{ with $feature.subscription }}
26-
<div class="flex flex-wrap gap-1">
27-
<span class="font-bold">Subscription:</span>
28-
{{ range . }}
29-
<span>{{ . }}</span>
30-
<span class="icon-svg">
31-
{{ $icon := index $subscriptionIcons . }}
32-
{{ if $icon }}
33-
{{ partial "icon" $icon }}
34-
{{ else }}
35-
{{ partial "icon" "default_icon" }}
36-
{{ end }}
37-
</span>
38-
{{ end }}
39-
</div>
40-
{{ end }}
4124

42-
{{ with $feature.availability }}
43-
{{ $availabilityText := . }}
44-
<div class="flex flex-wrap gap-1">
45-
<span class="font-bold">Availability:</span>
46-
<span>
25+
<div
26+
class="not-prose my-1 flex flex-col border-l-4 border-gray-light-200 bg-gray-light-200 bg-opacity-75 px-4 py-1 dark:bg-gray-dark-300 dark:bg-opacity-75"
27+
>
28+
{{ with $feature.subscription }}
29+
<div class="flex flex-wrap gap-1">
30+
<span class="font-bold">Subscription:</span>
31+
{{ range . }}
32+
<span>{{ . }}</span>
33+
<span class="icon-svg">
34+
{{ $icon := index $subscriptionIcons . }}
35+
{{ if $icon }}
36+
{{ partial "icon" $icon }}
37+
{{ else }}
38+
{{ partial "icon" "default_icon" }}
39+
{{ end }}
40+
</span>
41+
{{ end }}
42+
</div>
43+
{{ end }}
44+
45+
{{ with $feature.availability }}
46+
{{ $availabilityText := . }}
47+
<div class="flex flex-wrap gap-1">
48+
<span class="font-bold">Availability:</span>
49+
<span>
4750
{{ $availabilityText }}
4851
{{ range $key, $icon := $availabilityIcons }}
4952
{{ if in $availabilityText $key }}
5053
<span class="icon-svg">{{ partial "icon" $icon }}</span>
5154
{{ end }}
5255
{{ end }}
53-
</span>
54-
</div>
55-
{{ end }}
56+
</span>
57+
</div>
58+
{{ end }}
5659

57-
{{ with $feature.requires }}
58-
<div class="flex flex-wrap gap-1">
59-
<span class="font-bold">Requires:</span>
60-
<span>{{ . | markdownify }}</span>
61-
<span class="icon-svg">
60+
{{ with $feature.requires }}
61+
<div class="flex flex-wrap gap-1">
62+
<span class="font-bold">Requires:</span>
63+
<span>{{ . | markdownify }}</span>
64+
<span class="icon-svg">
6265
{{ partial "icon" $requiresIcon }}
63-
</span>
64-
</div>
65-
{{ end }}
66+
</span>
67+
</div>
68+
{{ end }}
6669

67-
{{ with $feature.for }}
68-
<div class="flex flex-wrap gap-1">
69-
<span class="font-bold">For:</span>
70-
<span>{{ . }}</span>
71-
<span class="icon-svg">
72-
{{ partial "icon" $forIcon }}
73-
</span>
70+
{{ with $feature.for }}
71+
<div class="flex flex-wrap gap-1">
72+
<span class="font-bold">For:</span>
73+
<span>{{ . }}</span>
74+
{{ if eq . "Administrators" }}
75+
<span class="icon-svg">
76+
{{ partial "icon" $forIcon }}
77+
</span>
78+
{{ end }}
79+
</div>
80+
{{ end }}
7481
</div>
75-
{{ end }}
76-
</div>
7782
{{ end }}

0 commit comments

Comments
 (0)