Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue