Skip to content

Commit 7f885a1

Browse files
committed
chore: refactored how margins in modal buttons work
1 parent 9f5fd85 commit 7f885a1

27 files changed

+57
-54
lines changed

ts/components/SessionPasswordPrompt.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function pushToastError(id: string, description: string) {
5656

5757
function ClearDataViewButtons({ onCancel }: { onCancel: () => void }) {
5858
return (
59-
<ModalActionsContainer>
59+
<ModalActionsContainer buttonType={SessionButtonType.Simple}>
6060
<SessionButton
6161
text={tr('clearDevice')}
6262
buttonColor={SessionButtonColor.Danger}
@@ -86,7 +86,7 @@ function PasswordViewButtons({
8686
}
8787

8888
return (
89-
<ModalActionsContainer>
89+
<ModalActionsContainer buttonType={SessionButtonType.Simple}>
9090
{showResetElements && (
9191
<SessionButton
9292
text={tr('clearDevice')}

ts/components/SessionWrapperModal.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { StyledRootDialog } from './dialog/StyledRootDialog';
1414
import { LUCIDE_ICONS_UNICODE } from './icon/lucide';
1515
import { IsModalScrolledContext, useIsModalScrolled } from '../contexts/IsModalScrolledContext';
1616
import { OnModalCloseContext, useOnModalClose } from '../contexts/OnModalCloseContext';
17-
import { SessionButton, SessionButtonColor } from './basic/SessionButton';
17+
import { SessionButton, SessionButtonColor, SessionButtonType } from './basic/SessionButton';
1818

1919
type WithExtraLeftButton = {
2020
/**
@@ -150,15 +150,15 @@ export const ModalActionsContainer = ({
150150
children,
151151
maxWidth,
152152
style = {},
153-
extraBottomMargin,
153+
buttonType,
154154
}: {
155155
children: ReactNode;
156156
style?: CSSProperties;
157157
maxWidth?: string;
158158
/**
159-
* some buttons have border/background and need some extra margin to not appear to close to the edge
159+
* Depending on the button type, the margin block is different.
160160
*/
161-
extraBottomMargin?: boolean;
161+
buttonType: SessionButtonType;
162162
}) => {
163163
return (
164164
<Flex
@@ -171,7 +171,8 @@ export const ModalActionsContainer = ({
171171
height="unset"
172172
style={{
173173
justifySelf: 'center',
174-
marginBottom: extraBottomMargin ? 'var(--margins-lg)' : 'var(--margins-md)',
174+
marginBlock:
175+
buttonType === SessionButtonType.Simple ? 'var(--margins-sm)' : 'var(--margins-lg)',
175176
...style,
176177
}}
177178
data-testid="modal-actions-container"

ts/components/calling/IncomingCallDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const IncomingCallDialog = () => {
8686
<ModalBasicHeader title={tr('callsIncoming', { name: from ?? tr('unknown') })} />
8787
}
8888
buttonChildren={
89-
<ModalActionsContainer>
89+
<ModalActionsContainer buttonType={SessionButtonType.Simple}>
9090
<SessionButton
9191
text={tr('accept')}
9292
buttonType={SessionButtonType.Simple}

ts/components/dialog/BanOrUnbanUserDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export const BanOrUnBanUserDialog = (props: {
126126
headerChildren={<ModalBasicHeader title={title} />}
127127
onClose={onClose}
128128
buttonChildren={
129-
<ModalActionsContainer>
129+
<ModalActionsContainer buttonType={SessionButtonType.Simple}>
130130
<SessionButton
131131
buttonType={SessionButtonType.Simple}
132132
onClick={banOrUnBanUser}

ts/components/dialog/DeleteAccountModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const DeleteAccountModal = () => {
125125
onClose={onClickCancelHandler}
126126
topAnchor="center"
127127
buttonChildren={
128-
<ModalActionsContainer>
128+
<ModalActionsContainer buttonType={SessionButtonType.Simple}>
129129
<SessionButton
130130
text={tr('clear')}
131131
buttonColor={SessionButtonColor.Danger}

ts/components/dialog/EditProfilePictureModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export const EditProfilePictureModal = ({ conversationId }: EditProfilePictureMo
248248
/>
249249
}
250250
buttonChildren={
251-
<ModalActionsContainer extraBottomMargin={true}>
251+
<ModalActionsContainer buttonType={SessionButtonType.Outline}>
252252
<SessionButton
253253
text={tr('save')}
254254
buttonType={SessionButtonType.Simple}

ts/components/dialog/EnterPasswordModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const EnterPasswordModal = (props: EnterPasswordModalProps) => {
7171
headerChildren={<ModalBasicHeader title={title} showExitIcon={true} />}
7272
$contentMinWidth={WrapperModalWidth.narrow}
7373
buttonChildren={
74-
<ModalActionsContainer>
74+
<ModalActionsContainer buttonType={SessionButtonType.Simple}>
7575
<SessionButton
7676
text={tr('done')}
7777
buttonType={SessionButtonType.Simple}

ts/components/dialog/HideRecoveryPasswordDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function HideRecoveryPasswordDialog(props: HideRecoveryPasswordDialogProp
7373
headerChildren={<ModalBasicHeader title={tr('recoveryPasswordHidePermanently')} />}
7474
onClose={onClose}
7575
buttonChildren={
76-
<ModalActionsContainer>
76+
<ModalActionsContainer buttonType={SessionButtonType.Simple}>
7777
<SessionButton {...leftButtonProps} buttonType={SessionButtonType.Simple} />
7878
<SessionButton {...rightButtonProps} buttonType={SessionButtonType.Simple} />
7979
</ModalActionsContainer>

ts/components/dialog/InviteContactsDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ const InviteContactsDialogInner = (props: Props) => {
179179
headerChildren={<ModalBasicHeader title={tr('membersInvite')} showExitIcon={true} />}
180180
modalDataTestId="invite-contacts-dialog"
181181
buttonChildren={
182-
<ModalActionsContainer>
182+
<ModalActionsContainer buttonType={SessionButtonType.Simple}>
183183
<SessionButton
184184
text={tr('membersInviteTitle')}
185185
buttonType={SessionButtonType.Simple}

ts/components/dialog/ModeratorsAddDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const AddModeratorsDialog = (props: Props) => {
8989
headerChildren={<ModalBasicHeader title={tr('addAdmins')} />}
9090
onClose={onClose}
9191
buttonChildren={
92-
<ModalActionsContainer>
92+
<ModalActionsContainer buttonType={SessionButtonType.Simple}>
9393
<SessionButton
9494
buttonType={SessionButtonType.Simple}
9595
onClick={addAsModerator}

0 commit comments

Comments
 (0)