Apply prettier formatting

This commit is contained in:
Michael Weimann 2022-12-12 12:24:14 +01:00
parent 1cac306093
commit 526645c791
No known key found for this signature in database
GPG key ID: 53F535A266BB9584
1576 changed files with 65385 additions and 62478 deletions

View file

@ -15,16 +15,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { RefObject } from 'react';
import React, { RefObject } from "react";
import { CATEGORY_HEADER_HEIGHT, EMOJI_HEIGHT, EMOJIS_PER_ROW } from "./EmojiPicker";
import LazyRenderList from "../elements/LazyRenderList";
import { DATA_BY_CATEGORY, IEmoji } from "../../../emoji";
import Emoji from './Emoji';
import Emoji from "./Emoji";
const OVERFLOW_ROWS = 3;
export type CategoryKey = (keyof typeof DATA_BY_CATEGORY) | "recent";
export type CategoryKey = keyof typeof DATA_BY_CATEGORY | "recent";
export interface ICategory {
id: CategoryKey;
@ -52,19 +52,21 @@ class Category extends React.PureComponent<IProps> {
private renderEmojiRow = (rowIndex: number) => {
const { onClick, onMouseEnter, onMouseLeave, selectedEmojis, emojis } = this.props;
const emojisForRow = emojis.slice(rowIndex * 8, (rowIndex + 1) * 8);
return (<div key={rowIndex}>{
emojisForRow.map(emoji => (
<Emoji
key={emoji.hexcode}
emoji={emoji}
selectedEmojis={selectedEmojis}
onClick={onClick}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
disabled={this.props.isEmojiDisabled?.(emoji.unicode)}
/>
))
}</div>);
return (
<div key={rowIndex}>
{emojisForRow.map((emoji) => (
<Emoji
key={emoji.hexcode}
emoji={emoji}
selectedEmojis={selectedEmojis}
onClick={onClick}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
disabled={this.props.isEmojiDisabled?.(emoji.unicode)}
/>
))}
</div>
);
};
render() {
@ -80,7 +82,7 @@ class Category extends React.PureComponent<IProps> {
const viewportTop = scrollTop;
const viewportBottom = viewportTop + viewportHeight;
const listTop = heightBefore + CATEGORY_HEADER_HEIGHT;
const listBottom = listTop + (rows.length * EMOJI_HEIGHT);
const listBottom = listTop + rows.length * EMOJI_HEIGHT;
const top = Math.max(viewportTop, listTop);
const bottom = Math.min(viewportBottom, listBottom);
// the viewport height and scrollTop passed to the LazyRenderList
@ -97,9 +99,7 @@ class Category extends React.PureComponent<IProps> {
role="tabpanel"
aria-label={name}
>
<h2 className="mx_EmojiPicker_category_label">
{ name }
</h2>
<h2 className="mx_EmojiPicker_category_label">{name}</h2>
<LazyRenderList
element="ul"
className="mx_EmojiPicker_list"