-
Notifications
You must be signed in to change notification settings - Fork 892
Improve user profile page #7791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
emilghittasv
wants to merge
1
commit into
mozilla:main
Choose a base branch
from
emilghittasv:improve-profile-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| {# Shared sidebar summary card for a person or group: avatar, name, an | ||
| optional username/meta line, an optional location line, an optional | ||
| primary action, and — when called with {% call %} — a .stat-list slot | ||
| wrapping whatever stats markup the caller supplies. | ||
|
|
||
| This macro only owns the entity's own identity summary. Quick actions, | ||
| moderator tools, and hierarchy info are separate cards the caller places | ||
| alongside it, not more arguments here. | ||
|
|
||
| Usage: | ||
| {% from "sumo/includes/entity_card.html" import entity_card %} | ||
| {% call entity_card(avatar_url, name, location=city) %} | ||
| <p>Whatever stats markup belongs in this entity's card.</p> | ||
| {% endcall %} | ||
| #} | ||
| {% macro entity_card(avatar_url, name, username=None, location=None, primary_action=None) %} | ||
| {# location/primary_action are often captured via {% set x %}...{% endset %} | ||
| blocks whose inner {% if %} didn't match — that leaves whitespace, not an | ||
| empty string, so check the stripped content rather than truthiness. #} | ||
| <div class="entity-card card elevation-01"> | ||
| <img class="entity-card--avatar" src="{{ avatar_url }}" alt=""> | ||
| <h2 class="entity-card--name">{{ name }}{% if username %} <span class="username">({{ username }})</span>{% endif %}</h2> | ||
| {% if location and location.strip() %}<h2 class="entity-card--location">{{ location.strip() }}</h2>{% endif %} | ||
| {% if primary_action and primary_action.strip() %}<div class="entity-card--action">{{ primary_action }}</div>{% endif %} | ||
| {% if caller %} | ||
| <div class="stat-list"> | ||
| {{ caller() }} | ||
| </div> | ||
| {% endif %} | ||
| </div> | ||
| {% endmacro %} |
78 changes: 78 additions & 0 deletions
78
kitsune/sumo/static/sumo/scss/components/_entity-card.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| @use '../config' as c; | ||
| @use 'protocol/css/includes/lib' as p; | ||
|
|
||
| // Entity card | ||
| // | ||
| // A sidebar summary card for a person or group: avatar, name, an optional | ||
| // meta line, an optional primary action, and an optional .stat-list of | ||
| // stat-item rows. | ||
| // | ||
| // Markup: ../../../../../../styleguide/styleguide-examples/entity-card.njk | ||
| // | ||
| // Weight: 6 | ||
| // | ||
| // Style guide: entity-card | ||
|
|
||
| // Base card look (padding, radius, shadow) comes from the shared .card and | ||
| // .elevation-01 classes applied alongside this one in markup — only the | ||
| // bits specific to this component live here. | ||
| .entity-card { | ||
| margin-bottom: p.$spacing-lg; | ||
| background: white; | ||
| text-align: center; | ||
|
|
||
| &--avatar { | ||
| display: block; | ||
| width: 96px; | ||
| height: 96px; | ||
| margin: 0 auto p.$spacing-sm; | ||
| border-radius: 50%; | ||
| border: 3px solid var(--color-marketing-gray-03); | ||
| object-fit: cover; | ||
| } | ||
|
|
||
| &--name { | ||
| @include c.sumo-callout-heading('no-fam'); | ||
| margin: 0 0 2px; | ||
| // A long display name or username (often one unbroken word) has no | ||
| // natural wrap point, and as a flex item this card won't shrink below | ||
| // that text's width by default — it forces the sidebar column wider | ||
| // than its assigned width instead of wrapping. | ||
| overflow-wrap: anywhere; | ||
| } | ||
|
|
||
| &--location { | ||
| @include c.text-body-sm; | ||
| color: var(--color-marketing-gray-06); | ||
| margin: 0; | ||
| font-weight: normal; | ||
| overflow-wrap: anywhere; | ||
| } | ||
|
|
||
| &--action { | ||
| margin-top: p.$spacing-md; | ||
|
|
||
| .sumo-button { | ||
| width: 100%; | ||
| } | ||
| } | ||
|
|
||
| &--secondary-link { | ||
| display: block; | ||
| margin-top: p.$spacing-xs; | ||
| @include c.text-body-xs; | ||
| color: var(--color-marketing-gray-06); | ||
| text-decoration: none; | ||
|
|
||
| &:hover { | ||
| color: var(--color-link); | ||
| } | ||
| } | ||
|
|
||
| .stat-list { | ||
| margin-top: p.$spacing-md; | ||
| padding-top: p.$spacing-md; | ||
| border-top: 1px solid var(--color-marketing-gray-03); | ||
| text-align: left; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we put this macro in
kitsune/sumo/jinja2/includes/common_macros.htmlinstead?