Skip to content

Commit 368b780

Browse files
committed
Adapt pricing comparison to phone and tablet layouts
1 parent 6681ab5 commit 368b780

8 files changed

Lines changed: 205 additions & 125 deletions

File tree

‎assets/css/custom.css‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,8 @@ ul.list-primary li::marker {
259259
@apply rounded-sm shadow-sm bg-white;
260260
}
261261

262-
/* The container's overflow-x-clip leaves the y axis visible, so it cannot clip
263-
the opaque corner cells to its own radius — they round themselves. */
264262
.compare-th {
265-
@apply lg:sticky lg:top-[var(--nav-height,48px)] z-10 align-bottom border-b border-gray-200 first:rounded-tl-sm last:rounded-tr-sm;
263+
@apply @min-[72rem]:sticky @min-[72rem]:top-[var(--nav-height,48px)] z-10 whitespace-nowrap border-b border-gray-200 bg-white align-bottom font-medium first:rounded-tl-sm last:rounded-tr-sm;
266264
}
267265

268266
.input-box {

‎i18n/de.yaml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,13 @@
11761176
- id: pricing_compare_title
11771177
translation: "Alle Funktionen im Vergleich"
11781178
- id: pricing_compare_subtitle
1179-
translation: "Jeder Plan enthält alles aus den vorherigen Plänen."
1179+
translation: "Finde den passenden Plan – Funktion für Funktion."
1180+
- id: pricing_compare_choose
1181+
translation: "Wähle zwei Pläne für den Vergleich."
1182+
- id: pricing_compare_first_plan
1183+
translation: "Erster Plan"
1184+
- id: pricing_compare_second_plan
1185+
translation: "Zweiter Plan"
11801186
- id: more_information
11811187
translation: "Weitere Informationen"
11821188
- id: pricing_compare_features

‎i18n/en.yaml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,13 @@
11771177
- id: pricing_compare_title
11781178
translation: "Compare All Features"
11791179
- id: pricing_compare_subtitle
1180-
translation: "Every plan includes everything from the plans before it."
1180+
translation: "See which plan fits your needs, feature by feature."
1181+
- id: pricing_compare_choose
1182+
translation: "Choose two plans to compare."
1183+
- id: pricing_compare_first_plan
1184+
translation: "First plan"
1185+
- id: pricing_compare_second_plan
1186+
translation: "Second plan"
11811187
- id: more_information
11821188
translation: "More information"
11831189
- id: pricing_compare_features
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- $page := .page }}
2+
{{- if eq .plan.dataKey "Standard" }}
3+
<a x-show="hosting === 'managed'" href="{{ $page.Site.LanguagePrefix }}/hub/managed/" class="btn btn-hub min-h-12 w-full content-center whitespace-normal break-words hyphens-auto" data-umami-event="pricing-compare-hub-standard-managed-cta">
4+
{{ i18n "pricing_hub_managed_cta" $page }}
5+
</a>
6+
<a x-show="hosting === 'self-hosted'" x-cloak href="{{ $page.Site.LanguagePrefix }}/hub/self-hosted/" class="btn btn-hub min-h-12 w-full content-center whitespace-normal break-words hyphens-auto" data-umami-event="pricing-compare-hub-standard-self-hosted-cta">
7+
{{ i18n "pricing_hub_self_hosted_cta" $page }}
8+
</a>
9+
{{- else }}
10+
<a href="{{ $page.Site.LanguagePrefix }}{{ .plan.href }}" class="btn {{ if eq .plan.dataKey "Cryptomator" }}btn-outline-primary{{ else }}btn-outline-hub{{ end }} min-h-12 w-full content-center whitespace-normal break-words hyphens-auto" data-umami-event="{{ .plan.event }}">
11+
{{ i18n .plan.ctaKey $page }}
12+
</a>
13+
{{- end }}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{- if eq .plan.dataKey "Standard" }}
2+
<p x-text="formattedPrice" class="font-semibold text-2xl @min-[72rem]:text-lg tabular-nums"></p>
3+
<p class="text-gray-700">{{ i18n "pricing_vat_excluded" .page }}</p>
4+
{{- else }}
5+
<p class="font-semibold text-2xl @min-[72rem]:text-lg">{{ i18n .plan.priceKey .page }}</p>
6+
{{- end }}
7+
<p class="text-gray-700">{{ i18n .plan.priceDescriptionKey .page }}</p>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- $cell := index .row .plan.dataKey }}
2+
{{- if eq $cell true }}
3+
<i class="fa-solid fa-check {{ if eq .plan.dataKey "Cryptomator" }}text-green-700{{ else }}text-hub{{ end }}" aria-hidden="true"></i>
4+
<span class="sr-only">{{ i18n "pricing_compare_included" .page }}</span>
5+
{{- else if eq $cell false }}
6+
<span class="text-gray-600" aria-hidden="true">&mdash;</span>
7+
<span class="sr-only">{{ i18n "pricing_compare_not_included" .page }}</span>
8+
{{- else if eq (printf "%T" $cell) "string" }}
9+
{{ i18n $cell .page }}
10+
{{- else if $cell }}
11+
{{ $cell }}
12+
{{- else }}
13+
{{- errorf "pricing_comparison: row %q is missing a value for plan %q" .row.LabelKey .plan.dataKey }}
14+
{{- end }}
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
{{- $cryptomatorBrand := dict "logo" "/img/logo.svg" "logoAspect" "aspect-1110/942" "brandColor" "text-primary" }}
2+
{{- $hubBrand := dict "logo" "/img/zero-knowledge-bot.svg" "logoAspect" "aspect-988/877" "brandColor" "text-hub" }}
3+
{{- $plans := slice
4+
(merge $cryptomatorBrand (dict "dataKey" "Cryptomator" "brand" "Cryptomator" "titleKey" "pricing_individual_title" "priceKey" "pricing_free" "priceDescriptionKey" "pricing_individual_price_description" "href" "/downloads/" "ctaKey" "pricing_individual_cta" "event" "pricing-compare-individual-cta"))
5+
(merge $hubBrand (dict "dataKey" "Community" "brand" "Cryptomator Hub" "titleKey" "pricing_hub_community_title" "priceKey" "pricing_free" "priceDescriptionKey" "pricing_hub_community_price_description" "href" "/hub/self-hosted/" "ctaKey" "pricing_hub_self_hosted_cta" "event" "pricing-compare-hub-community-self-hosted-cta"))
6+
(merge $hubBrand (dict "dataKey" "Standard" "brand" "Cryptomator Hub" "titleKey" "pricing_hub_standard_title" "priceDescriptionKey" "pricing_hub_standard_price_description"))
7+
(merge $hubBrand (dict "dataKey" "Enterprise" "brand" "Cryptomator Hub" "titleKey" "pricing_hub_enterprise_title" "priceKey" "pricing_hub_enterprise_price" "priceDescriptionKey" "pricing_hub_enterprise_price_description" "href" "/contact-sales/" "ctaKey" "pricing_hub_enterprise_cta" "event" "pricing-compare-hub-enterprise-cta"))
8+
}}
9+
<section aria-labelledby="pricing-comparison-title" class="py-12" x-data="{ first: 'Community', second: 'Standard' }">
10+
<div class="mb-8 lg:text-center">
11+
<h2 id="pricing-comparison-title" class="font-h2 mb-3 text-balance">{{ i18n "pricing_compare_title" . }}</h2>
12+
<p class="max-w-[56ch] text-base text-pretty text-gray-700 lg:mx-auto">{{ i18n "pricing_compare_subtitle" . }}</p>
13+
</div>
14+
<div class="@container">
15+
<div class="@min-[72rem]:hidden" x-cloak>
16+
<p class="mb-4 text-base text-gray-700">{{ i18n "pricing_compare_choose" . }}</p>
17+
<div class="white-box">
18+
<div class="sticky top-[var(--nav-height,48px)] z-10 grid grid-cols-2 rounded-t-sm border-b border-gray-200 bg-white @min-[40rem]:grid-cols-[2fr_1fr_1fr]">
19+
<div class="@max-[40rem]:hidden self-end p-4 font-medium text-gray-700">{{ i18n "pricing_compare_features" . }}</div>
20+
{{- range $side := slice "first" "second" }}
21+
<div class="min-w-0 border-t-[3px] border-transparent px-2 py-3 {{ if eq $side "first" }}rounded-tl-sm @min-[40rem]:rounded-tl-none{{ else }}rounded-tr-sm{{ end }} @min-[40rem]:px-4" :class="{ 'border-hub bg-hub/10': {{ $side }} === 'Standard', 'border-transparent': {{ $side }} !== 'Standard' }">
22+
{{- range $plans }}
23+
<div x-show="{{ $side }} === '{{ .dataKey }}'" class="mb-3 text-center">
24+
<img src="{{ .logo }}" class="mx-auto mb-2 h-8 {{ .logoAspect }}" alt=""/>
25+
<p class="font-headline text-xs font-bold uppercase tracking-wide {{ .brandColor }}">{{ .brand }}</p>
26+
</div>
27+
{{- end }}
28+
<label for="compare-{{ $side }}" class="sr-only">{{ i18n (printf "pricing_compare_%s_plan" $side) $ }}</label>
29+
<div class="grid grid-cols-[1fr_--spacing(8)]">
30+
<select id="compare-{{ $side }}" name="compare-{{ $side }}" x-model="{{ $side }}" class="input-box col-span-full row-start-1 min-h-12 w-full min-w-0 appearance-none bg-white bg-none pl-2 pr-7 text-base font-medium">
31+
{{- range $plans }}
32+
<option value="{{ .dataKey }}" :disabled="{{ if eq $side "first" }}second{{ else }}first{{ end }} === '{{ .dataKey }}'">{{ i18n .titleKey $ }}</option>
33+
{{- end }}
34+
</select>
35+
<i class="fa-solid fa-chevron-down pointer-events-none col-start-2 row-start-1 place-self-center text-hub" aria-hidden="true"></i>
36+
</div>
37+
</div>
38+
{{- end }}
39+
</div>
40+
{{- range hugo.Data.pricing_comparison }}
41+
<section>
42+
<h3 class="border-b border-gray-200 bg-gray-100 px-4 py-3 font-headline text-base font-semibold text-hub">{{ i18n .SectionKey $ }}</h3>
43+
<dl>
44+
{{- range .Rows }}
45+
{{- $row := . }}
46+
<div class="grid grid-cols-2 border-b border-gray-200 last:border-b-0 @min-[40rem]:grid-cols-[2fr_1fr_1fr]">
47+
<dt class="col-span-full px-4 pt-4 pb-2 font-medium @min-[40rem]:col-span-1 @min-[40rem]:py-4">
48+
{{ i18n .LabelKey $ }}
49+
{{- with .TooltipKey }}
50+
<p class="mt-1 text-base font-normal text-gray-700 [&_a]:text-hub [&_a]:underline">{{ i18n . $ | safeHTML }}</p>
51+
{{- end }}
52+
</dt>
53+
{{- range $side := slice "first" "second" }}
54+
<dd class="flex min-w-0 items-center justify-center px-2 py-3 text-center text-base text-gray-700 tabular-nums @min-[40rem]:p-4" :class="{ 'bg-hub/5': {{ $side }} === 'Standard' }">
55+
{{- range $plans }}
56+
<div x-show="{{ $side }} === '{{ .dataKey }}'">
57+
<span class="sr-only">{{ .brand }} {{ i18n .titleKey $ }}: </span>
58+
{{ partial "pricing/comparison-value.html" (dict "row" $row "plan" . "page" $) }}
59+
</div>
60+
{{- end }}
61+
</dd>
62+
{{- end }}
63+
</div>
64+
{{- end }}
65+
</dl>
66+
</section>
67+
{{- end }}
68+
<div class="grid grid-cols-2 border-t border-gray-200 @min-[40rem]:grid-cols-[2fr_1fr_1fr]">
69+
<div class="@max-[40rem]:hidden"></div>
70+
{{- range $side := slice "first" "second" }}
71+
<div class="min-w-0 p-3 text-center @min-[40rem]:p-4" :class="{ 'bg-hub/5': {{ $side }} === 'Standard' }">
72+
{{- range $plans }}
73+
<div x-show="{{ $side }} === '{{ .dataKey }}'" class="flex h-full flex-col gap-3">
74+
<h3 class="mx-auto w-fit rounded-full px-3 py-1 text-base font-medium {{ if eq .dataKey "Cryptomator" }}bg-primary/10 text-green-700{{ else }}bg-hub/10 text-hub{{ end }}">{{ i18n .titleKey $ }}</h3>
75+
<div class="grow">
76+
{{ partial "pricing/comparison-price.html" (dict "plan" . "page" $) }}
77+
</div>
78+
{{ partial "pricing/comparison-action.html" (dict "plan" . "page" $) }}
79+
</div>
80+
{{- end }}
81+
</div>
82+
{{- end }}
83+
</div>
84+
</div>
85+
</div>
86+
{{/* Without Alpine, the full table stays available as a scrollable fallback. */}}
87+
<div class="-mx-4 -my-2 overflow-x-auto whitespace-nowrap @min-[72rem]:overflow-visible" :class="{ '@max-[72rem]:hidden': true }">
88+
<div class="inline-block min-w-full px-4 py-2 align-middle">
89+
<table class="white-box w-full min-w-[880px] border-separate border-spacing-0 text-sm @min-[72rem]:min-w-full" aria-labelledby="pricing-comparison-title">
90+
<thead>
91+
<tr>
92+
<td class="compare-th w-[28%] px-5 py-3.5 text-left"><span class="sr-only">{{ i18n "pricing_compare_features" . }}</span></td>
93+
{{- range $plans }}
94+
<th scope="col" class="compare-th px-4 py-3.5 text-center{{ if eq .dataKey "Standard" }} bg-linear-to-b from-hub/10 to-hub/10 border-t-[3px] border-t-hub{{ end }}">
95+
<img src="{{ .logo }}" class="mx-auto mb-2 h-8 {{ .logoAspect }}" alt=""/>
96+
<p class="mb-1 font-headline text-xs font-bold uppercase tracking-wide {{ .brandColor }}">{{ .brand }}</p>
97+
<p class="font-headline font-medium">{{ i18n .titleKey $ }}</p>
98+
</th>
99+
{{- end }}
100+
</tr>
101+
</thead>
102+
{{- range $sectionIndex, $section := hugo.Data.pricing_comparison }}
103+
<tbody aria-label="{{ i18n .SectionKey $ }}">
104+
<tr>
105+
<td class="px-5 pb-1.5 pt-4">
106+
<h3 class="text-xs font-bold uppercase tracking-wide text-gray-700">{{ i18n .SectionKey $ }}</h3>
107+
</td>
108+
{{- range $plans }}
109+
<td{{ if eq .dataKey "Standard" }} class="bg-hub/5"{{ end }}></td>
110+
{{- end }}
111+
</tr>
112+
{{- range $rowIndex, $row := .Rows }}
113+
<tr>
114+
<th scope="row" class="whitespace-normal border-t border-gray-200 px-5 py-3 text-left font-medium text-gray-700">
115+
{{ i18n .LabelKey $ }}
116+
{{- with .TooltipKey }}
117+
{{- $tooltipId := printf "tooltip-compare-%d-%d" $sectionIndex $rowIndex }}
118+
<div class="has-tooltip">
119+
<i class="fa-solid fa-info-circle text-gray-700" tabindex="0" role="img" aria-label="{{ i18n "more_information" $ }}" aria-describedby="{{ $tooltipId }}"></i>
120+
<div id="{{ $tooltipId }}" role="tooltip" class="tooltip tooltip-center w-64 whitespace-normal rounded-sm bg-white p-3 text-sm font-normal shadow-md [&_a]:text-hub [&_a]:underline">{{ i18n . $ | safeHTML }}</div>
121+
</div>
122+
{{- end }}
123+
</th>
124+
{{- range $plans }}
125+
<td class="border-t border-gray-200 px-4 py-3 text-center font-medium tabular-nums{{ if eq .dataKey "Standard" }} bg-hub/5{{ end }}">
126+
{{ partial "pricing/comparison-value.html" (dict "row" $row "plan" . "page" $) }}
127+
</td>
128+
{{- end }}
129+
</tr>
130+
{{- end }}
131+
</tbody>
132+
{{- end }}
133+
<tfoot>
134+
<tr>
135+
<td class="border-t border-gray-200"></td>
136+
{{- range $plans }}
137+
<td class="border-t border-gray-200 px-4 pt-4 text-center align-top whitespace-normal{{ if eq .dataKey "Standard" }} bg-hub/5{{ end }}">
138+
{{ partial "pricing/comparison-price.html" (dict "plan" . "page" $) }}
139+
</td>
140+
{{- end }}
141+
</tr>
142+
<tr>
143+
<td></td>
144+
{{- range $plans }}
145+
<td class="px-4 pb-4 pt-3 text-center align-top whitespace-normal{{ if eq .dataKey "Standard" }} bg-hub/5{{ end }}">
146+
{{ partial "pricing/comparison-action.html" (dict "plan" . "page" $) }}
147+
</td>
148+
{{- end }}
149+
</tr>
150+
</tfoot>
151+
</table>
152+
</div>
153+
</div>
154+
</div>
155+
</section>

0 commit comments

Comments
 (0)