Skip to content

Commit 1f80d98

Browse files
committed
feat: Try another design for fip validity
1 parent 1064ef9 commit 1f80d98

File tree

8 files changed

+64
-101
lines changed

8 files changed

+64
-101
lines changed

assets/sass/fipValidity.scss

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,8 @@
55
margin-bottom: 1.2rem;
66

77
&__tags {
8-
display: flex;
9-
flex-wrap: wrap;
10-
gap: 0.6rem;
11-
}
12-
13-
&__footnotes {
148
display: flex;
159
flex-direction: column;
16-
gap: 0.4rem;
17-
font-size: 0.9em;
18-
}
19-
20-
&__footnote {
21-
display: flex;
22-
gap: 0.4rem;
23-
align-items: baseline;
24-
}
25-
26-
&__footnote-number {
27-
font-weight: 600;
28-
flex-shrink: 0;
29-
}
30-
31-
&__footnote-text {
32-
p {
33-
margin: 0;
34-
display: inline;
35-
}
36-
}
37-
38-
&__note {
39-
p {
40-
margin: 0;
41-
display: inline;
42-
}
10+
gap: 0.8rem;
4311
}
4412
}

assets/sass/fipValidityItem.scss

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.a-fip-validity-item {
2+
display: flex;
3+
align-items: flex-start;
4+
gap: 0.5rem;
5+
font-size: 0.95em;
6+
font-weight: 400;
7+
line-height: 1.2em;
8+
9+
@each $name, $color in $tag-colors {
10+
&--#{$name} {
11+
color: var(--tag-#{$name}-color);
12+
}
13+
}
14+
15+
&__content {
16+
display: flex;
17+
flex-direction: column;
18+
gap: 0.2rem;
19+
}
20+
21+
&__note {
22+
font-size: 0.8em;
23+
color: var(--color-body);
24+
font-weight: 400;
25+
26+
p {
27+
margin: 0;
28+
display: inline;
29+
}
30+
}
31+
}

assets/sass/main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
@import "trainCategory.scss";
2121
@import "tag.scss";
2222
@import "fipValidity.scss";
23+
@import "fipValidityItem.scss";

assets/sass/tag.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,4 @@
1515
border: 0.1rem solid var(--tag-#{$name}-border);
1616
}
1717
}
18-
19-
&__footnote {
20-
font-weight: 600;
21-
}
2218
}

content/operator/sncf/index.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ SNCF (Société Nationale des Chemins de fer Français) is the French national r
2929

3030
## Validity of FIP Tickets
3131

32-
{{< fip-validity fip_global_fare_footnote="For international `TGV` trains, see [International TGV inOui / ICE trains](#international-tgv-inoui--ice-trains)">}}
32+
{{< fip-validity fip_global_fare_footnote="Only for international `TGV` trains, see [International TGV inOui / ICE trains](#international-tgv-inoui--ice-trains)">}}
3333

3434
FIP Coupons and FIP 50 Tickets are valid on SNCF services. For cross-border journeys on local trains, either a continuous FIP 50 Ticket or FIP Coupons for both countries are required. For international long-distance services (`TGV` or `ICE`), global fares apply (see [International TGV inOui / ICE trains](#international-tgv-inoui--ice-trains)).
3535

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div class="a-fip-validity-item a-fip-validity-item--{{ .Type }}">
2+
{{ partial "icon" .Icon }}
3+
<div class="a-fip-validity-item__content">
4+
<span class="a-fip-validity-item__text">{{ i18n .Text }}</span>
5+
{{- with .Note -}}
6+
<span class="a-fip-validity-item__note">{{ . }}</span>
7+
{{- end -}}
8+
</div>
9+
</div>

layouts/partials/tag.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
<span class="a-tag a-tag--{{ .Type }}">
22
{{ partial "icon" .Icon }}
3-
<span class="a-tag__text"
4-
>{{ i18n .Text }}{{- with .Footnote -}}
5-
<sup class="a-tag__footnote">{{ . }}</sup>
6-
{{- end -}}</span
7-
>
3+
<span class="a-tag__text">{{ i18n .Text }}</span>
84
</span>
Lines changed: 20 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,70 @@
11
{{- $page := .Page -}}
2-
{{- $footnotes := dict -}}
3-
4-
{{- with .Get "fip_coupon_footnote" -}}
5-
{{- $footnotes = merge $footnotes (dict "fip_coupon" .) -}}
6-
{{- end -}}
7-
{{- with .Get "fip_coupon_relatives_footnote" -}}
8-
{{- $footnotes = merge $footnotes (dict "fip_coupon_relatives" .) -}}
9-
{{- end -}}
10-
{{- with .Get "fip_50_ticket_footnote" -}}
11-
{{- $footnotes = merge $footnotes (dict "fip_50_ticket" .) -}}
12-
{{- end -}}
13-
{{- with .Get "fip_global_fare_footnote" -}}
14-
{{- $footnotes = merge $footnotes (dict "fip_global_fare" .) -}}
15-
{{- end -}}
16-
17-
{{- $footnoteCounter := 0 -}}
18-
{{- $footnoteMap := dict -}}
192

203

214
<div class="o-fip-validity">
225
<div class="o-fip-validity__tags">
236
{{- if isset $page.Params "fip_coupon" -}}
247
{{- $accepted := $page.Params.fip_coupon -}}
25-
{{- $footnoteNum := "" -}}
26-
{{- if isset $footnotes "fip_coupon" -}}
27-
{{- $footnoteCounter = add $footnoteCounter 1 -}}
28-
{{- $footnoteNum = printf "%d)" $footnoteCounter -}}
29-
{{- $footnoteMap = merge $footnoteMap (dict (string $footnoteCounter) (index $footnotes "fip_coupon")) -}}
8+
{{- $note := "" -}}
9+
{{- with .Get "fip_coupon_footnote" -}}
10+
{{- $note = $page.RenderString . -}}
3011
{{- end -}}
31-
{{- partial "tag" (
12+
{{- partial "fip-validity-item" (
3213
dict
3314
"Icon" (cond $accepted "check_circle" "cancel")
3415
"Text" "fipValidity.fip-coupon"
3516
"Type" (cond $accepted "success" "error")
36-
"Footnote" $footnoteNum
17+
"Note" $note
3718
)
3819
}}
3920
{{- end -}}
4021

4122
{{- if isset $page.Params "fip_coupon_relatives" -}}
4223
{{- $accepted := $page.Params.fip_coupon_relatives -}}
43-
{{- $footnoteNum := "" -}}
44-
{{- if isset $footnotes "fip_coupon_relatives" -}}
45-
{{- $footnoteCounter = add $footnoteCounter 1 -}}
46-
{{- $footnoteNum = printf "%d)" $footnoteCounter -}}
47-
{{- $footnoteMap = merge $footnoteMap (dict (string $footnoteCounter) (index $footnotes "fip_coupon_relatives")) -}}
24+
{{- $note := "" -}}
25+
{{- with .Get "fip_coupon_relatives_footnote" -}}
26+
{{- $note = $page.RenderString . -}}
4827
{{- end -}}
49-
{{- partial "tag" (
28+
{{- partial "fip-validity-item" (
5029
dict
5130
"Icon" (cond $accepted "check_circle" "cancel")
5231
"Text" "fipValidity.fip-coupon-relatives"
5332
"Type" (cond $accepted "success" "error")
54-
"Footnote" $footnoteNum
33+
"Note" $note
5534
)
5635
}}
5736
{{- end -}}
5837

5938
{{- if isset $page.Params "fip_50_ticket" -}}
6039
{{- $accepted := $page.Params.fip_50_ticket -}}
61-
{{- $footnoteNum := "" -}}
62-
{{- if isset $footnotes "fip_50_ticket" -}}
63-
{{- $footnoteCounter = add $footnoteCounter 1 -}}
64-
{{- $footnoteNum = printf "%d)" $footnoteCounter -}}
65-
{{- $footnoteMap = merge $footnoteMap (dict (string $footnoteCounter) (index $footnotes "fip_50_ticket")) -}}
40+
{{- $note := "" -}}
41+
{{- with .Get "fip_50_ticket_footnote" -}}
42+
{{- $note = $page.RenderString . -}}
6643
{{- end -}}
67-
{{- partial "tag" (
44+
{{- partial "fip-validity-item" (
6845
dict
6946
"Icon" (cond $accepted "check_circle" "cancel")
7047
"Text" "fipValidity.fip-50-ticket"
7148
"Type" (cond $accepted "success" "error")
72-
"Footnote" $footnoteNum
49+
"Note" $note
7350
)
7451
}}
7552
{{- end -}}
7653

7754
{{- if isset $page.Params "fip_global_fare" -}}
7855
{{- $accepted := $page.Params.fip_global_fare -}}
79-
{{- $footnoteNum := "" -}}
80-
{{- if isset $footnotes "fip_global_fare" -}}
81-
{{- $footnoteCounter = add $footnoteCounter 1 -}}
82-
{{- $footnoteNum = printf "%d)" $footnoteCounter -}}
83-
{{- $footnoteMap = merge $footnoteMap (dict (string $footnoteCounter) (index $footnotes "fip_global_fare")) -}}
56+
{{- $note := "" -}}
57+
{{- with .Get "fip_global_fare_footnote" -}}
58+
{{- $note = $page.RenderString . -}}
8459
{{- end -}}
85-
{{- partial "tag" (
60+
{{- partial "fip-validity-item" (
8661
dict
8762
"Icon" (cond $accepted "check_circle" "cancel")
8863
"Text" "fipValidity.fip-global-fare"
8964
"Type" (cond $accepted "success" "error")
90-
"Footnote" $footnoteNum
65+
"Note" $note
9166
)
9267
}}
9368
{{- end -}}
9469
</div>
95-
96-
{{- if gt (len $footnoteMap) 0 -}}
97-
<div class="o-fip-validity__footnotes">
98-
{{- range $index, $text := $footnoteMap -}}
99-
<div class="o-fip-validity__footnote">
100-
<span class="o-fip-validity__footnote-number">{{ $index }})</span>
101-
<span class="o-fip-validity__footnote-text"
102-
>{{ $text | $page.RenderString }}</span
103-
>
104-
</div>
105-
{{- end -}}
106-
</div>
107-
{{- end -}}
10870
</div>

0 commit comments

Comments
 (0)