Improve style

Signed-off-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
Tulir Asokan 2019-10-14 20:38:09 +03:00
parent e16d0bfa4d
commit a6e0986bf8
3 changed files with 41 additions and 24 deletions

View file

@ -36,6 +36,16 @@ limitations under the License.
border-bottom: 1px solid $message-action-bar-border-color; border-bottom: 1px solid $message-action-bar-border-color;
} }
.mx_EmojiPicker button > svg {
width: 100%;
height: 100%;
fill: $primary-fg-color;
}
.mx_EmojiPicker button:disabled > svg {
fill: $focus-bg-color;
}
.mx_EmojiPicker_anchor { .mx_EmojiPicker_anchor {
border: none; border: none;
padding: 8px 8px 6px; padding: 8px 8px 6px;
@ -43,14 +53,11 @@ limitations under the License.
background-color: transparent; background-color: transparent;
border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0;
svg { width: 36px;
width: 20px; height: 38px;
height: 20px;
fill: $primary-fg-color;
}
&:disabled svg { &:not(:disabled) {
fill: $focus-bg-color; cursor: pointer;
} }
&:not(:disabled):hover { &:not(:disabled):hover {
@ -80,32 +87,33 @@ limitations under the License.
button { button {
border: none; border: none;
background-color: inherit; background-color: inherit;
padding: 0; margin: 0;
margin: 8px; padding: 8px;
svg {
align-self: center; align-self: center;
width: 16px; width: 32px;
height: 16px; height: 32px;
} }
} }
.mx_EmojiPicker_search_clear {
cursor: pointer;
} }
.mx_EmojiPicker_category { .mx_EmojiPicker_category {
padding: 0 12px; padding: 0 12px;
display: flex;
flex-direction: column;
align-items: center;
} }
.mx_EmojiPicker_category_label, .mx_EmojiPicker_preview_name { .mx_EmojiPicker_category_label {
font-size: 16px; width: 304px;
font-weight: 600;
margin: 0;
} }
.mx_EmojiPicker_list { .mx_EmojiPicker_list {
width: 304px;
padding: 0; padding: 0;
margin: 0; margin: 0;
// TODO the emoji rows need to be center-aligned, but the individual emojis shouldn't be.
//text-align: center;
} }
.mx_EmojiPicker_item { .mx_EmojiPicker_item {
@ -125,6 +133,12 @@ limitations under the License.
} }
} }
.mx_EmojiPicker_category_label, .mx_EmojiPicker_preview_name {
font-size: 16px;
font-weight: 600;
margin: 0;
}
.mx_EmojiPicker_footer { .mx_EmojiPicker_footer {
border-top: 1px solid $message-action-bar-border-color; border-top: 1px solid $message-action-bar-border-color;
height: 72px; height: 72px;

View file

@ -168,7 +168,6 @@ class EmojiPicker extends React.Component {
} }
scrollToCategory(category) { scrollToCategory(category) {
const index = this.categories.findIndex(cat => cat.id === category);
this.bodyRef.current.querySelector(`[data-category-id="${category}"]`).scrollIntoView(); this.bodyRef.current.querySelector(`[data-category-id="${category}"]`).scrollIntoView();
} }
@ -179,7 +178,10 @@ class EmojiPicker extends React.Component {
emojis = id === "recent" ? this.recentlyUsed : DATA_BY_CATEGORY[id]; emojis = id === "recent" ? this.recentlyUsed : DATA_BY_CATEGORY[id];
} }
this.memoizedDataByCategory[id] = emojis.filter(emoji => emoji.filterString.includes(filter)); this.memoizedDataByCategory[id] = emojis.filter(emoji => emoji.filterString.includes(filter));
this.categories.find(cat => cat.id === id).enabled = this.memoizedDataByCategory[id].length > 0; const cat = this.categories.find(cat => cat.id === id);
cat.enabled = this.memoizedDataByCategory[id].length > 0;
// The setState below doesn't re-render the header and we already have the refs for updateVisibility, so...
cat.ref.current.disabled = !cat.enabled;
} }
this.setState({ filter }); this.setState({ filter });
// Header underlines need to be updated, but updating requires knowing // Header underlines need to be updated, but updating requires knowing

View file

@ -30,7 +30,8 @@ class Search extends React.PureComponent {
<div className="mx_EmojiPicker_search"> <div className="mx_EmojiPicker_search">
<input type="text" placeholder="Search" value={this.props.query} <input type="text" placeholder="Search" value={this.props.query}
onChange={ev => this.props.onChange(ev.target.value)}/> onChange={ev => this.props.onChange(ev.target.value)}/>
<button onClick={() => this.props.onChange("")}> <button onClick={() => this.props.onChange("")}
className={this.props.query ? "mx_EmojiPicker_search_clear" : ""}>
{this.props.query ? icons.search.delete() : icons.search.search()} {this.props.query ? icons.search.delete() : icons.search.search()}
</button> </button>
</div> </div>