Fix pills.

This was a hard pill to swallow
This commit is contained in:
Jorik Schellekens 2020-04-03 17:53:49 +01:00
parent 92005b15d8
commit e2aef3a62b
4 changed files with 43 additions and 36 deletions

View file

@ -6,11 +6,14 @@
.mx_RoomPill, .mx_RoomPill,
.mx_GroupPill, .mx_GroupPill,
.mx_AtRoomPill { .mx_AtRoomPill {
border-radius: 16px; display: inline-flex;
display: inline-block; align-items: center;
height: 20px; vertical-align: middle;
border-radius: $font-16px;
height: $font-16px;
line-height: $font-20px; line-height: $font-20px;
padding-left: 5px; padding-left: 0;
padding-right: 0.5em;
} }
a.mx_Pill { a.mx_Pill {
@ -19,6 +22,11 @@ a.mx_Pill {
overflow: hidden; overflow: hidden;
vertical-align: text-bottom; vertical-align: text-bottom;
max-width: calc(100% - 1ch); max-width: calc(100% - 1ch);
height: $font-24px;
}
.mx_Pill {
padding: 0.3rem;
} }
/* More specific to override `.markdown-body a` text-decoration */ /* More specific to override `.markdown-body a` text-decoration */
@ -31,7 +39,6 @@ a.mx_Pill {
.mx_UserPill { .mx_UserPill {
color: $primary-fg-color; color: $primary-fg-color;
background-color: $other-user-pill-bg-color; background-color: $other-user-pill-bg-color;
padding-right: 5px;
} }
.mx_UserPill_selected { .mx_UserPill_selected {
@ -45,7 +52,6 @@ a.mx_Pill {
.mx_MessageComposer_input .mx_AtRoomPill { .mx_MessageComposer_input .mx_AtRoomPill {
color: $accent-fg-color; color: $accent-fg-color;
background-color: $mention-user-pill-bg-color; background-color: $mention-user-pill-bg-color;
padding-right: 5px;
} }
/* More specific to override `.markdown-body a` color */ /* More specific to override `.markdown-body a` color */
@ -55,15 +61,6 @@ a.mx_Pill {
.mx_GroupPill { .mx_GroupPill {
color: $accent-fg-color; color: $accent-fg-color;
background-color: $rte-room-pill-color; background-color: $rte-room-pill-color;
padding-right: 5px;
}
/* More specific to override `.markdown-body a` color */
.mx_EventTile_content .markdown-body a.mx_GroupPill,
.mx_GroupPill {
color: $accent-fg-color;
background-color: $rte-group-pill-color;
padding-right: 5px;
} }
.mx_EventTile_body .mx_UserPill, .mx_EventTile_body .mx_UserPill,
@ -77,8 +74,10 @@ a.mx_Pill {
.mx_GroupPill .mx_BaseAvatar, .mx_GroupPill .mx_BaseAvatar,
.mx_AtRoomPill .mx_BaseAvatar { .mx_AtRoomPill .mx_BaseAvatar {
position: relative; position: relative;
left: -3px; display: inline-flex;
top: 2px; align-items: center;
border-radius: 10rem;
margin-right: 0.24rem;
} }
.mx_Markdown_BOLD { .mx_Markdown_BOLD {

View file

@ -31,9 +31,10 @@
} }
.mx_Autocomplete_Completion_pill { .mx_Autocomplete_Completion_pill {
border-radius: 17px; box-sizing: border-box;
height: 34px; border-radius: 2rem;
padding: 0px 5px; height: $font-34px;
padding: 0.4rem;
display: flex; display: flex;
user-select: none; user-select: none;
cursor: pointer; cursor: pointer;
@ -42,7 +43,7 @@
} }
.mx_Autocomplete_Completion_pill > * { .mx_Autocomplete_Completion_pill > * {
margin: 0 3px; margin-right: 0.3rem;
} }
/* styling for common completion elements */ /* styling for common completion elements */

View file

@ -46,22 +46,19 @@ limitations under the License.
&.mx_BasicMessageComposer_input_shouldShowPillAvatar { &.mx_BasicMessageComposer_input_shouldShowPillAvatar {
span.mx_UserPill, span.mx_RoomPill { span.mx_UserPill, span.mx_RoomPill {
padding-left: 21px;
position: relative; position: relative;
// avatar psuedo element // avatar psuedo element
&::before { &::before {
position: absolute;
left: 2px;
top: 2px;
content: var(--avatar-letter); content: var(--avatar-letter);
width: 16px; width: $font-16px;
height: 16px; height: $font-16px;
margin-right: 0.24rem;
background: var(--avatar-background), $avatar-bg-color; background: var(--avatar-background), $avatar-bg-color;
color: $avatar-initial-color; color: $avatar-initial-color;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 16px; background-size: $font-16px;
border-radius: 8px; border-radius: $font-16px;
text-align: center; text-align: center;
font-weight: normal; font-weight: normal;
line-height: $font-16px; line-height: $font-16px;

View file

@ -164,9 +164,9 @@ export default createReactClass({
const initialLetter = AvatarLogic.getInitialLetter(name); const initialLetter = AvatarLogic.getInitialLetter(name);
const textNode = ( const textNode = (
<span className="mx_BaseAvatar_initial" aria-hidden="true" <span className="mx_BaseAvatar_initial" aria-hidden="true"
style={{ fontSize: (width * 0.65) + "px", style={{ fontSize: (width * 0.65) / 15 + "rem",
width: width + "px", width: width / 15 + "rem",
lineHeight: height + "px" }} lineHeight: height / 15 + "rem" }}
> >
{ initialLetter } { initialLetter }
</span> </span>
@ -174,7 +174,11 @@ export default createReactClass({
const imgNode = ( const imgNode = (
<img className="mx_BaseAvatar_image" src={imageUrl} <img className="mx_BaseAvatar_image" src={imageUrl}
alt="" title={title} onError={this.onError} alt="" title={title} onError={this.onError}
width={width} height={height} aria-hidden="true" /> aria-hidden="true"
style={{
width: width/15 + "rem",
height: height/15 + "rem"
}} />
); );
if (onClick != null) { if (onClick != null) {
return ( return (
@ -202,7 +206,10 @@ export default createReactClass({
src={imageUrl} src={imageUrl}
onClick={onClick} onClick={onClick}
onError={this.onError} onError={this.onError}
width={width} height={height} style={{
width: width/15 + "rem",
height: height/15 + "rem"
}}
title={title} alt="" title={title} alt=""
inputRef={inputRef} inputRef={inputRef}
{...otherProps} /> {...otherProps} />
@ -213,7 +220,10 @@ export default createReactClass({
className="mx_BaseAvatar mx_BaseAvatar_image" className="mx_BaseAvatar mx_BaseAvatar_image"
src={imageUrl} src={imageUrl}
onError={this.onError} onError={this.onError}
width={width} height={height} style={{
width: width/15 + "rem",
height: height/15 + "rem"
}}
title={title} alt="" title={title} alt=""
ref={inputRef} ref={inputRef}
{...otherProps} /> {...otherProps} />