Skip to content

Commit aa81a6f

Browse files
committed
feat(user info): Show icon
Use an icon instead of a long sentence saves some precious screen space and is widely adopted.
1 parent a19b862 commit aa81a6f

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

app/assets/builds/alchemy/admin.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/helpers/alchemy/admin/base_helper.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ module BaseHelper
2121
def current_alchemy_user_name
2222
name = current_alchemy_user.try(:alchemy_display_name)
2323
if name.present?
24-
content_tag :span, "#{Alchemy.t("Logged in as")} #{name}", class: "current-user-name"
24+
content_tag :span, class: "current-user-name" do
25+
"#{render_icon(:user, size: "1x")} #{name}".html_safe
26+
end
2527
end
2628
end
2729

app/stylesheets/alchemy/admin/frame.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ div#overlay_text_box {
117117
}
118118

119119
.current-user-name {
120+
display: flex;
121+
align-items: center;
122+
gap: var(--spacing-1);
120123
padding: 0 var(--spacing-3);
121124

122125
@media screen and (max-width: vars.$large-screen-break-point) {

spec/helpers/alchemy/admin/base_helper_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ module Alchemy
176176
let(:user) { double("User", alchemy_display_name: "Peter Schroeder") }
177177

178178
it "Returns a span showing the name of the currently logged in user." do
179-
is_expected.to have_content("#{Alchemy.t("Logged in as")} Peter Schroeder")
179+
is_expected.to have_content("Peter Schroeder")
180180
is_expected.to have_selector("span.current-user-name")
181181
end
182182
end

0 commit comments

Comments
 (0)