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

View file

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

View file

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

View file

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