Modal: Adjust styles for Radio and Checkbox group list (#5676)

This commit is contained in:
Alexander Zinchuk 2025-03-01 17:59:46 +01:00
parent 00c23c8052
commit 48b98f7494
6 changed files with 17 additions and 2 deletions

View File

@ -77,6 +77,7 @@ const ReportAvatarModal: FC<OwnProps> = ({
title={title} title={title}
> >
<RadioGroup <RadioGroup
className="dialog-checkbox-group"
name="report-message" name="report-message"
options={REPORT_OPTIONS} options={REPORT_OPTIONS}
onChange={handleSelectReason} onChange={handleSelectReason}

View File

@ -99,6 +99,7 @@ const ChatFolderModal: FC<OwnProps & StateProps> = ({
> >
<div className={buildClassName(styles.main, 'custom-scroll')}> <div className={buildClassName(styles.main, 'custom-scroll')}>
<CheckboxGroup <CheckboxGroup
className="dialog-checkbox-group"
options={folders} options={folders}
selected={selectedFolderIds} selected={selectedFolderIds}
onChange={setSelectedFolderIds} onChange={setSelectedFolderIds}

View File

@ -75,6 +75,7 @@ const MuteChatModal: FC<OwnProps> = ({
title={lang('Notifications')} title={lang('Notifications')}
> >
<RadioGroup <RadioGroup
className="dialog-checkbox-group"
name="muteFor" name="muteFor"
options={muteForOptions} options={muteForOptions}
selected={muteUntilOption} selected={muteUntilOption}

View File

@ -4,6 +4,8 @@ import React, { memo, useState } from '../../lib/teact/teact';
import type { ApiUser } from '../../api/types'; import type { ApiUser } from '../../api/types';
import buildClassName from '../../util/buildClassName';
import useLastCallback from '../../hooks/useLastCallback'; import useLastCallback from '../../hooks/useLastCallback';
import Checkbox from './Checkbox'; import Checkbox from './Checkbox';
@ -26,6 +28,7 @@ type OwnProps = {
loadingOptions?: string[]; loadingOptions?: string[];
isRound?: boolean; isRound?: boolean;
onChange: (value: string[]) => void; onChange: (value: string[]) => void;
className?: string;
}; };
const CheckboxGroup: FC<OwnProps> = ({ const CheckboxGroup: FC<OwnProps> = ({
@ -37,6 +40,7 @@ const CheckboxGroup: FC<OwnProps> = ({
loadingOptions, loadingOptions,
isRound, isRound,
onChange, onChange,
className,
}) => { }) => {
const [values, setValues] = useState<string[]>(selected || []); const [values, setValues] = useState<string[]>(selected || []);
@ -80,7 +84,7 @@ const CheckboxGroup: FC<OwnProps> = ({
}); });
return ( return (
<div id={id} className="radio-group"> <div id={id} className={buildClassName('radio-group', className)}>
{options.map((option) => { {options.map((option) => {
return ( return (
<Checkbox <Checkbox

View File

@ -203,6 +203,10 @@
margin: 1rem -1.125rem; margin: 1rem -1.125rem;
} }
.dialog-checkbox-group {
margin: 0 -1.125rem 1rem;
}
.confirm-dialog-button { .confirm-dialog-button {
width: auto; width: auto;
height: auto; height: auto;

View File

@ -2,6 +2,8 @@ import type { ChangeEvent } from 'react';
import type { FC, TeactNode } from '../../lib/teact/teact'; import type { FC, TeactNode } from '../../lib/teact/teact';
import React, { memo, useCallback } from '../../lib/teact/teact'; import React, { memo, useCallback } from '../../lib/teact/teact';
import buildClassName from '../../util/buildClassName';
import useLastCallback from '../../hooks/useLastCallback'; import useLastCallback from '../../hooks/useLastCallback';
import Radio from './Radio'; import Radio from './Radio';
@ -27,6 +29,7 @@ type OwnProps = {
withIcon?: boolean; withIcon?: boolean;
subLabelClassName?: string; subLabelClassName?: string;
subLabel?: TeactNode; subLabel?: TeactNode;
className?: string;
}; };
const RadioGroup: FC<OwnProps> = ({ const RadioGroup: FC<OwnProps> = ({
@ -42,6 +45,7 @@ const RadioGroup: FC<OwnProps> = ({
isLink, isLink,
withIcon, withIcon,
subLabel, subLabel,
className,
}) => { }) => {
const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>) => { const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {
const { value } = event.currentTarget; const { value } = event.currentTarget;
@ -53,7 +57,7 @@ const RadioGroup: FC<OwnProps> = ({
}); });
return ( return (
<div id={id} className="radio-group"> <div id={id} className={buildClassName('radio-group', className)}>
{options.map((option) => ( {options.map((option) => (
<Radio <Radio
name={name} name={name}