Composer: Adjust layouts in tooltips (#2107)

This commit is contained in:
Alexander Zinchuk 2022-11-07 23:00:32 +04:00
parent 923c946167
commit 88c0aced2b
6 changed files with 24 additions and 13 deletions

View File

@ -1,4 +1,6 @@
.StickerButton { .StickerButton {
--custom-emoji-size: 2.5rem;
display: inline-block; display: inline-block;
width: 4rem; width: 4rem;
height: 4rem; height: 4rem;
@ -11,8 +13,8 @@
--premium-gradient: linear-gradient(88.39deg, #6C93FF -2.56%, #976FFF 51.27%, #DF69D1 107.39%); --premium-gradient: linear-gradient(88.39deg, #6C93FF -2.56%, #976FFF 51.27%, #DF69D1 107.39%);
&.custom-emoji { &.custom-emoji {
width: 2.5rem; width: var(--custom-emoji-size);
height: 2.5rem; height: var(--custom-emoji-size);
margin: 0.3125rem; margin: 0.3125rem;
} }

View File

@ -1295,18 +1295,18 @@ const Composer: FC<OwnProps & StateProps> = ({
onClose={closeBotCommandMenu} onClose={closeBotCommandMenu}
/> />
)} )}
<StickerTooltip
chatId={chatId}
threadId={threadId}
isOpen={isStickerTooltipOpen}
onStickerSelect={handleStickerSelect}
/>
<CustomEmojiTooltip <CustomEmojiTooltip
chatId={chatId} chatId={chatId}
isOpen={isCustomEmojiTooltipOpen} isOpen={isCustomEmojiTooltipOpen}
onCustomEmojiSelect={insertCustomEmoji} onCustomEmojiSelect={insertCustomEmoji}
addRecentCustomEmoji={addRecentCustomEmoji} addRecentCustomEmoji={addRecentCustomEmoji}
/> />
<StickerTooltip
chatId={chatId}
threadId={threadId}
isOpen={isStickerTooltipOpen}
onStickerSelect={handleStickerSelect}
/>
<EmojiTooltip <EmojiTooltip
isOpen={isEmojiTooltipOpen} isOpen={isEmojiTooltipOpen}
emojis={filteredEmojis} emojis={filteredEmojis}

View File

@ -1,14 +1,21 @@
.root:global(.composer-tooltip) { .root:global(.composer-tooltip) {
display: flex; display: flex;
padding-left: 0.25rem; padding: 0;
z-index: 1;
overflow-y: hidden;
overflow-x: auto; overflow-x: auto;
@supports (overflow-x: overlay) { @supports (overflow-x: overlay) {
overflow-x: overlay; overflow-x: overlay;
} }
overflow-y: hidden;
.emojiButton { .emojiButton {
flex: 0 0 2.5rem; flex: 0 0 2.5rem;
--custom-emoji-size: 2rem;
margin: 0.5rem 0 0.5rem 0.25rem;
}
&:global(.shown + .StickerTooltip) {
transform: translateY(-1.75rem);
} }
} }

View File

@ -7,7 +7,7 @@ import type { FC } from '../../../lib/teact/teact';
import type { ApiSticker } from '../../../api/types'; import type { ApiSticker } from '../../../api/types';
import type { GlobalActions } from '../../../global/types'; import type { GlobalActions } from '../../../global/types';
import { EMOJI_SIZE_PICKER } from '../../../config'; import { COMPOSER_EMOJI_SIZE_PICKER } from '../../../config';
import { selectIsChatWithSelf, selectIsCurrentUserPremium } from '../../../global/selectors'; import { selectIsChatWithSelf, selectIsCurrentUserPremium } from '../../../global/selectors';
import buildClassName from '../../../util/buildClassName'; import buildClassName from '../../../util/buildClassName';
import captureEscKeyListener from '../../../util/captureEscKeyListener'; import captureEscKeyListener from '../../../util/captureEscKeyListener';
@ -90,7 +90,7 @@ const CustomEmojiTooltip: FC<OwnProps & StateProps> = ({
key={sticker.id} key={sticker.id}
sticker={sticker} sticker={sticker}
className={styles.emojiButton} className={styles.emojiButton}
size={EMOJI_SIZE_PICKER} size={COMPOSER_EMOJI_SIZE_PICKER}
observeIntersection={observeIntersection} observeIntersection={observeIntersection}
onClick={handleCustomEmojiSelect} onClick={handleCustomEmojiSelect}
clickArg={sticker} clickArg={sticker}

View File

@ -1,6 +1,6 @@
.EmojiTooltip { .EmojiTooltip {
display: flex; display: flex;
padding-left: 0.25rem; padding: 0;
overflow-x: auto; overflow-x: auto;
@supports (overflow-x: overlay) { @supports (overflow-x: overlay) {
@ -10,5 +10,6 @@
.EmojiButton { .EmojiButton {
flex: 0 0 2.5rem; flex: 0 0 2.5rem;
margin-right: 0;
} }
} }

View File

@ -139,6 +139,7 @@ export const STICKER_SIZE_AUTH = 160;
export const STICKER_SIZE_AUTH_MOBILE = 120; export const STICKER_SIZE_AUTH_MOBILE = 120;
export const STICKER_SIZE_PICKER = 64; export const STICKER_SIZE_PICKER = 64;
export const EMOJI_SIZE_PICKER = 40; export const EMOJI_SIZE_PICKER = 40;
export const COMPOSER_EMOJI_SIZE_PICKER = 32;
export const STICKER_SIZE_GENERAL_SETTINGS = 48; export const STICKER_SIZE_GENERAL_SETTINGS = 48;
export const STICKER_SIZE_PICKER_HEADER = 32; export const STICKER_SIZE_PICKER_HEADER = 32;
export const STICKER_SIZE_SEARCH = 64; export const STICKER_SIZE_SEARCH = 64;