Skip to content

Commit 067fbce

Browse files
author
julioest
committed
Add User Card logged-out variant
Ref boostorg#2177
1 parent 4c539f8 commit 067fbce

3 files changed

Lines changed: 94 additions & 0 deletions

File tree

static/css/v3/user-card.css

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,53 @@ html.dark .user-card--green.card {
152152
font-size: var(--font-size-xl);
153153
}
154154

155+
/* ==========================================================================
156+
Logged-out variant (heading + description + Sign up CTA)
157+
========================================================================== */
158+
159+
.user-card--logged-out.card {
160+
max-width: 340px;
161+
padding: 0;
162+
gap: var(--space-card);
163+
background-color: var(--color-surface-weak-accent-teal);
164+
}
165+
166+
.user-card--logged-out .user-card__heading,
167+
.user-card--logged-out .user-card__description,
168+
.user-card--logged-out .btn-row {
169+
padding-left: var(--space-card);
170+
padding-right: var(--space-card);
171+
padding-top: 0;
172+
padding-bottom: 0;
173+
}
174+
175+
.user-card--logged-out .user-card__heading {
176+
padding-top: var(--space-card);
177+
}
178+
179+
.user-card--logged-out .btn-row {
180+
padding-bottom: var(--space-card);
181+
}
182+
183+
.user-card--logged-out .user-card__heading {
184+
color: var(--color-text-primary);
185+
font-family: var(--font-display);
186+
font-size: var(--font-size-large);
187+
font-weight: var(--font-weight-medium);
188+
line-height: var(--line-height-tight);
189+
letter-spacing: var(--letter-spacing-display-regular);
190+
margin: 0;
191+
}
192+
193+
.user-card--logged-out .user-card__description {
194+
color: var(--color-text-secondary);
195+
font-size: var(--font-size-base);
196+
font-weight: var(--font-weight-regular);
197+
line-height: var(--line-height-default);
198+
letter-spacing: -0.16px;
199+
margin: 0;
200+
}
201+
155202
/* ==========================================================================
156203
Dark mode — scoped overrides
157204
========================================================================== */
@@ -165,6 +212,16 @@ html.dark .user-card--green.card {
165212
background-color: var(--user-card-cta-bg-hover);
166213
}
167214

215+
/* ==========================================================================
216+
Tablet
217+
========================================================================== */
218+
219+
@media (max-width: 1024px) {
220+
.user-card--logged-out.card {
221+
max-width: 234px;
222+
}
223+
}
224+
168225
/* ==========================================================================
169226
Mobile
170227
========================================================================== */
@@ -185,4 +242,12 @@ html.dark .user-card--green.card {
185242
font-size: var(--font-size-large);
186243
}
187244

245+
.user-card--logged-out.card {
246+
max-width: 100%;
247+
}
248+
249+
.user-card--logged-out .btn {
250+
font-size: var(--font-size-small);
251+
}
252+
188253
}

templates/v3/examples/_v3_example_section.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,15 @@ <h3>{{ section_title }}</h3>
356356
</div>
357357
{% endwith %}
358358

359+
{% with section_title="User Card (logged out)" %}
360+
<div class="v3-examples-section__block" id="{{ section_title|slugify }}">
361+
<h3>{{ section_title }}</h3>
362+
<div class="v3-examples-section__example-box">
363+
{% include "v3/includes/_user_card.html" with logged_out=True cta_url="#" %}
364+
</div>
365+
</div>
366+
{% endwith %}
367+
359368
{% with section_title="Create Account Card" %}
360369
<div class="v3-examples-section__block" id="{{ section_title|slugify }}">
361370
<h3>{{ section_title }}</h3>

templates/v3/includes/_user_card.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
cta_url (string, optional) - CTA button target URL. Omit to hide button.
1414
cta_label (string, optional) - CTA button text. Defaults to "Create Post".
1515
compact (bool, optional) - Render compact variant (no background, no CTA). Default false.
16+
logged_out (bool, optional) - Render logged-out variant (heading, description, Sign up CTA). Default false.
17+
heading (string, optional) - Heading text for logged-out variant.
18+
description (string, optional) - Description text for logged-out variant.
1619
extra_attrs (string, optional) - Extra HTML attributes for analytics (rendered raw)
1720

1821
Usage:
@@ -21,7 +24,23 @@
2124

2225
Compact (no background, no CTA):
2326
{% include "v3/includes/_user_card.html" with username="vinniefalco" avatar_url="/img/avatar.png" compact=True %}
27+
28+
Logged out (heading, description, Sign up CTA):
29+
{% include "v3/includes/_user_card.html" with logged_out=True heading="Join the Boost Community" description="Sign up to create posts, earn badges, and contribute to the community." cta_url="/sign-up/" cta_label="Sign Up" %}
2430
{% endcomment %}
31+
{% if logged_out %}
32+
<section class="user-card user-card--logged-out card" aria-label="{{ heading|default:"Create an account" }}" {{ extra_attrs|safe }}>
33+
<h3 class="user-card__heading">{{ heading|default:"Create an account" }}</h3>
34+
<hr class="card__hr">
35+
<p class="user-card__description">{{ description|default:"Advance your career, learn from experts, and help shape the future of Boost and C++." }}</p>
36+
{% if cta_url %}
37+
<hr class="card__hr">
38+
<div class="btn-row">
39+
{% include "v3/includes/_button.html" with url=cta_url label=cta_label|default:"Sign up now" style="teal" extra_classes="btn-flex" %}
40+
</div>
41+
{% endif %}
42+
</section>
43+
{% else %}
2544
<section class="user-card {% if compact %}user-card--compact{% else %}user-card--lg user-card--green{% endif %} card" aria-label="{{ username }}" {{ extra_attrs|safe }}>
2645

2746
{# Avatar with flag overlay #}
@@ -62,3 +81,4 @@
6281
{% endif %}
6382

6483
</section>
84+
{% endif %}

0 commit comments

Comments
 (0)