Fix close button position in various modals
This commit is contained in:
parent
f5b0e8ba62
commit
d04c811f8f
@ -17,10 +17,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modal-header {
|
.modal-header {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0.25rem 0.5rem;
|
|
||||||
|
|
||||||
.Button {
|
.Button {
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -244,7 +244,7 @@ const ChatOrUserPicker: FC<OwnProps> = ({
|
|||||||
function renderTopicList() {
|
function renderTopicList() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="modal-header" dir={oldLang.isRtl ? 'rtl' : undefined}>
|
<div className="modal-header modal-header-condensed" dir={oldLang.isRtl ? 'rtl' : undefined}>
|
||||||
<Button round color="translucent" size="smaller" ariaLabel={oldLang('Back')} onClick={handleHeaderBackClick}>
|
<Button round color="translucent" size="smaller" ariaLabel={oldLang('Back')} onClick={handleHeaderBackClick}>
|
||||||
<Icon name="arrow-left" />
|
<Icon name="arrow-left" />
|
||||||
</Button>
|
</Button>
|
||||||
@ -291,7 +291,7 @@ const ChatOrUserPicker: FC<OwnProps> = ({
|
|||||||
function renderChatList() {
|
function renderChatList() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="modal-header" dir={oldLang.isRtl ? 'rtl' : undefined}>
|
<div className="modal-header modal-header-condensed" dir={oldLang.isRtl ? 'rtl' : undefined}>
|
||||||
<Button
|
<Button
|
||||||
round
|
round
|
||||||
color="translucent"
|
color="translucent"
|
||||||
@ -335,9 +335,9 @@ const ChatOrUserPicker: FC<OwnProps> = ({
|
|||||||
<Modal
|
<Modal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
className={buildClassName('ChatOrUserPicker', className)}
|
className={buildClassName('ChatOrUserPicker', className)}
|
||||||
|
isLowStackPriority={isLowStackPriority}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
onCloseAnimationEnd={onCloseAnimationEnd}
|
onCloseAnimationEnd={onCloseAnimationEnd}
|
||||||
isLowStackPriority={isLowStackPriority}
|
|
||||||
>
|
>
|
||||||
<Transition activeKey={activeKey} name="slideFade" slideClassName="ChatOrUserPicker_slide">
|
<Transition activeKey={activeKey} name="slideFade" slideClassName="ChatOrUserPicker_slide">
|
||||||
{() => {
|
{() => {
|
||||||
|
|||||||
@ -32,7 +32,6 @@ const PickerModal = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
|
||||||
{...modalProps}
|
{...modalProps}
|
||||||
isSlim
|
isSlim
|
||||||
className={buildClassName(
|
className={buildClassName(
|
||||||
@ -42,6 +41,7 @@ const PickerModal = ({
|
|||||||
)}
|
)}
|
||||||
contentClassName={buildClassName(styles.content, modalProps.contentClassName)}
|
contentClassName={buildClassName(styles.content, modalProps.contentClassName)}
|
||||||
headerClassName={buildClassName(styles.header, modalProps.headerClassName)}
|
headerClassName={buildClassName(styles.header, modalProps.headerClassName)}
|
||||||
|
isCondensedHeader
|
||||||
>
|
>
|
||||||
{modalProps.children}
|
{modalProps.children}
|
||||||
{hasButton && (
|
{hasButton && (
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modal-header-condensed {
|
.modal-header-condensed {
|
||||||
padding: 0.375rem 1.125rem !important;
|
|
||||||
border-bottom: 1px solid transparent;
|
border-bottom: 1px solid transparent;
|
||||||
transition: border-color 250ms ease-in-out;
|
transition: border-color 250ms ease-in-out;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
import type { FC } from '../../../lib/teact/teact';
|
|
||||||
import type React from '../../../lib/teact/teact';
|
import type React from '../../../lib/teact/teact';
|
||||||
import {
|
import type { FC } from '../../../lib/teact/teact';
|
||||||
memo, useEffect, useMemo, useRef, useState,
|
import { memo, useEffect, useMemo, useRef, useState } from '../../../lib/teact/teact';
|
||||||
} from '../../../lib/teact/teact';
|
|
||||||
import { getActions, withGlobal } from '../../../global';
|
import { getActions, withGlobal } from '../../../global';
|
||||||
|
|
||||||
import type {
|
import type { ApiAttachment, ApiChatMember, ApiMessage, ApiSticker } from '../../../api/types';
|
||||||
ApiAttachment, ApiChatMember, ApiMessage, ApiSticker,
|
|
||||||
} from '../../../api/types';
|
|
||||||
import type { GlobalState } from '../../../global/types';
|
import type { GlobalState } from '../../../global/types';
|
||||||
import type { MessageListType, ThreadId } from '../../../types';
|
import type { MessageListType, ThreadId } from '../../../types';
|
||||||
import type { Signal } from '../../../util/signals';
|
import type { Signal } from '../../../util/signals';
|
||||||
@ -544,7 +540,7 @@ const AttachmentModal: FC<OwnProps & StateProps> = ({
|
|||||||
{notEditingFile && !isInAlbum
|
{notEditingFile && !isInAlbum
|
||||||
&& (
|
&& (
|
||||||
<DropdownMenu
|
<DropdownMenu
|
||||||
className="attachmeneditingMessaget-modal-more-menu with-menu-transitions"
|
className="with-menu-transitions"
|
||||||
trigger={MoreMenuButton}
|
trigger={MoreMenuButton}
|
||||||
positionX="right"
|
positionX="right"
|
||||||
>
|
>
|
||||||
@ -623,17 +619,18 @@ const AttachmentModal: FC<OwnProps & StateProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isBottomDividerShown = !areAttachmentsScrolledToBottom || !isCaptionNotScrolled;
|
const isBottomDividerShown = !areAttachmentsScrolledToBottom || !isCaptionNotScrolled;
|
||||||
const buttonSendCaption = paidMessagesStars ? formatStarsAsIcon(lang,
|
const buttonSendCaption = paidMessagesStars ? formatStarsAsIcon(
|
||||||
|
lang,
|
||||||
attachmentsLength * paidMessagesStars,
|
attachmentsLength * paidMessagesStars,
|
||||||
{
|
{
|
||||||
className: styles.sendButtonStar,
|
className: styles.sendButtonStar,
|
||||||
asFont: true,
|
asFont: true,
|
||||||
}) : oldLang('Send');
|
},
|
||||||
|
) : oldLang('Send');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
onClose={onClear}
|
|
||||||
header={renderHeader()}
|
header={renderHeader()}
|
||||||
className={buildClassName(
|
className={buildClassName(
|
||||||
styles.root,
|
styles.root,
|
||||||
@ -643,8 +640,10 @@ const AttachmentModal: FC<OwnProps & StateProps> = ({
|
|||||||
isSymbolMenuOpen && styles.symbolMenuOpen,
|
isSymbolMenuOpen && styles.symbolMenuOpen,
|
||||||
forceDarkTheme && 'component-theme-dark',
|
forceDarkTheme && 'component-theme-dark',
|
||||||
)}
|
)}
|
||||||
|
hasAbsoluteCloseButton={Boolean(renderingAttachments)}
|
||||||
noBackdropClose
|
noBackdropClose
|
||||||
isLowStackPriority
|
isLowStackPriority
|
||||||
|
onClose={onClear}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={styles.dropTarget}
|
className={styles.dropTarget}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
.content {
|
.content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -86,8 +86,6 @@ type StateProps = {
|
|||||||
botAppPermissions?: BotAppPermissions;
|
botAppPermissions?: BotAppPermissions;
|
||||||
};
|
};
|
||||||
|
|
||||||
const NBSP = '\u00A0';
|
|
||||||
|
|
||||||
const MAIN_BUTTON_ANIMATION_TIME = 250;
|
const MAIN_BUTTON_ANIMATION_TIME = 250;
|
||||||
const ANIMATION_WAIT = 400;
|
const ANIMATION_WAIT = 400;
|
||||||
const COLLAPSING_WAIT = 350;
|
const COLLAPSING_WAIT = 350;
|
||||||
@ -1111,12 +1109,12 @@ const WebAppModalTabContent: FC<OwnProps & StateProps> = ({
|
|||||||
{popupParameters && (
|
{popupParameters && (
|
||||||
<Modal
|
<Modal
|
||||||
isOpen={Boolean(popupParameters)}
|
isOpen={Boolean(popupParameters)}
|
||||||
title={popupParameters.title || NBSP}
|
title={popupParameters.title}
|
||||||
onClose={handleAppPopupModalClose}
|
|
||||||
hasCloseButton
|
|
||||||
className={
|
className={
|
||||||
buildClassName(styles.webAppPopup, !popupParameters.title?.trim().length && styles.withoutTitle)
|
buildClassName(styles.webAppPopup, !popupParameters.title?.trim().length && styles.withoutTitle)
|
||||||
}
|
}
|
||||||
|
hasAbsoluteCloseButton
|
||||||
|
onClose={handleAppPopupModalClose}
|
||||||
>
|
>
|
||||||
{popupParameters.message}
|
{popupParameters.message}
|
||||||
<div className="dialog-buttons mt-2">
|
<div className="dialog-buttons mt-2">
|
||||||
|
|||||||
@ -133,14 +133,14 @@
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
&:not(:only-child) {
|
&:not(:only-child) {
|
||||||
margin: 0 1.5rem;
|
margin: 0 1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-header-condensed {
|
.modal-header-condensed {
|
||||||
@extend %modal-header;
|
@extend %modal-header;
|
||||||
|
|
||||||
padding: 0.5rem 1.25rem 0 0.9375rem !important;
|
padding: 0.375rem 0.5rem !important;
|
||||||
|
|
||||||
.modal-action-button {
|
.modal-action-button {
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|||||||
@ -54,6 +54,8 @@ export type OwnProps = {
|
|||||||
isCondensedHeader?: boolean;
|
isCondensedHeader?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const NBSP = '\u00A0';
|
||||||
|
|
||||||
const Modal: FC<OwnProps> = ({
|
const Modal: FC<OwnProps> = ({
|
||||||
dialogRef,
|
dialogRef,
|
||||||
title,
|
title,
|
||||||
@ -146,27 +148,22 @@ const Modal: FC<OwnProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!title && !withCloseButton) return undefined;
|
if (!title && !withCloseButton) return undefined;
|
||||||
const closeButton = (
|
|
||||||
<Button
|
|
||||||
className={buildClassName(hasAbsoluteCloseButton && 'modal-absolute-close-button')}
|
|
||||||
round
|
|
||||||
color={absoluteCloseButtonColor}
|
|
||||||
size="smaller"
|
|
||||||
ariaLabel={lang('Close')}
|
|
||||||
onClick={onClose}
|
|
||||||
>
|
|
||||||
<Icon name="close" />
|
|
||||||
</Button>
|
|
||||||
);
|
|
||||||
|
|
||||||
if (hasAbsoluteCloseButton) {
|
|
||||||
return closeButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={buildClassName('modal-header', headerClassName, isCondensedHeader && 'modal-header-condensed')}>
|
<div className={buildClassName('modal-header', headerClassName, isCondensedHeader && 'modal-header-condensed')}>
|
||||||
{withCloseButton && closeButton}
|
{withCloseButton && (
|
||||||
<div className="modal-title">{title}</div>
|
<Button
|
||||||
|
className={buildClassName(hasAbsoluteCloseButton && 'modal-absolute-close-button')}
|
||||||
|
round
|
||||||
|
color={absoluteCloseButtonColor}
|
||||||
|
size="smaller"
|
||||||
|
ariaLabel={lang('Close')}
|
||||||
|
onClick={onClose}
|
||||||
|
>
|
||||||
|
<Icon name="close" />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
<div className="modal-title">{title || NBSP}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user