Skip to content
This repository was archived by the owner on Aug 9, 2024. It is now read-only.

Commit 8d93a58

Browse files
authored
Avatar Updates (#173)
* Clean up avatars * Increase specificity of margin: 0
1 parent 9b07af8 commit 8d93a58

File tree

5 files changed

+20
-73
lines changed

5 files changed

+20
-73
lines changed

app/assets/stylesheets/sage/system/patterns/objects/_live_avatar.scss

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ $-live-avatar-ring-colors: (
3535
);
3636
$-live-avatar-tile-size: rem(216px);
3737

38+
@mixin live-avatar-scaling() {
39+
width: 100%;
40+
height: 100%;
41+
}
42+
3843
.sage-live-avatar {
3944
display: grid;
4045
grid-template-columns: 100%;
@@ -79,14 +84,11 @@ $-live-avatar-tile-size: rem(216px);
7984
@include sage-feature-live-avatar-ring();
8085
}
8186

82-
.sage-live-avatar--scaling {
83-
width: 100%;
84-
height: 100%;
85-
}
86-
8787
.sage-live-avatar--tile {
8888
padding: sage-spacing(md);
8989
border-radius: initial;
90+
91+
@include live-avatar-scaling;
9092
}
9193

9294
// Set up color variations

app/assets/stylesheets/sage/system/vendor/_reboot.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ button::-moz-focus-inner,
266266
input[type="radio"],
267267
input[type="checkbox"] {
268268
box-sizing: border-box;
269+
margin: 0;
269270
padding: 0;
270271
}
271272

app/views/sage/examples/objects/live_avatar/_markup.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="sage-live-avatar <%= color != "" ? "sage-live-avatar--#{color}" : "" %> <%= hasRing ? "sage-live-avatar--ring" : "" %> <%= scale ? "sage-live-avatar--scaling" : "" %> <%= custom_class %>">
1+
<div class="sage-live-avatar<%= color != "" ? " sage-live-avatar--#{color}" : "" %><%= hasRing ? " sage-live-avatar--ring" : "" %><%= scale ? " sage-live-avatar--scaling" : "" %><%= custom_class %>">
22
<svg class="sage-live-avatar__initials" viewBox="0 0 40 40">
33
<text text-anchor="middle" x="19.5" y="24"><%= initials %></text>
44
</svg>

app/views/sage/examples/objects/live_avatar/_preview.html.erb

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -58,70 +58,4 @@
5858
scale: false,
5959
custom_class: ""
6060
%>
61-
</div>
62-
63-
<div class="sage-live-avatar-wrapper">
64-
<div style="width: 40px; height: 40px;">
65-
<%= render "sage/examples/objects/live_avatar/markup",
66-
initials: "JC",
67-
color: "purple",
68-
hasRing: false,
69-
url: "",
70-
scale: true,
71-
custom_class: ""
72-
%>
73-
</div>
74-
<div style="width: 128px; height: 128px;">
75-
<%= render "sage/examples/objects/live_avatar/markup",
76-
initials: "JC",
77-
color: "purple",
78-
hasRing: false,
79-
url: "",
80-
scale: true,
81-
custom_class: ""
82-
%>
83-
</div>
84-
<div style="width: 256px; height: 256px;">
85-
<%= render "sage/examples/objects/live_avatar/markup",
86-
initials: "JC",
87-
color: "purple",
88-
hasRing: false,
89-
url: "",
90-
scale: true,
91-
custom_class: ""
92-
%>
93-
</div>
94-
</div>
95-
96-
<div class="sage-live-avatar-wrapper">
97-
<div style="width: 40px; height: 40px;">
98-
<%= render "sage/examples/objects/live_avatar/markup",
99-
initials: "LJ",
100-
color: "",
101-
hasRing: false,
102-
url: "../../assets/sage/avatar/jay.png",
103-
scale: true,
104-
custom_class: ""
105-
%>
106-
</div>
107-
<div style="width: 128px; height: 128px;">
108-
<%= render "sage/examples/objects/live_avatar/markup",
109-
initials: "LJ",
110-
color: "",
111-
hasRing: false,
112-
url: "../../assets/sage/avatar/jay.png",
113-
scale: true,
114-
custom_class: ""
115-
%>
116-
</div>
117-
<div style="width: 256px; height: 256px;">
118-
<%= render "sage/examples/objects/live_avatar/markup",
119-
initials: "LJ",
120-
color: "",
121-
hasRing: false,
122-
url: "../../assets/sage/avatar/jay.png",
123-
scale: true,
124-
custom_class: ""
125-
%>
126-
</div>
127-
</div>
61+
</div>

app/views/sage/examples/objects/live_avatar/_props.html.erb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@
1919
<td>Boolean</td>
2020
<td>false</td>
2121
</tr>
22+
<tr>
23+
<td>tile</td>
24+
<td>
25+
With the <code>--tile</code> modifier this component can become scalable as the core part of
26+
a tile. In such cases, the initials or avatar image will be centered on a background depending
27+
on the color passed in. The tile container should provide the sizing constraints.
28+
</td>
29+
<td>Boolean</td>
30+
<td>false</td>
31+
</tr>

0 commit comments

Comments
 (0)