Merge pull request #4893 from matrix-org/t3chguy/room-list/101

Radio button outline fixes including for new room list context menu
pull/21833/head
Michael Telatynski 2020-07-03 20:35:17 +01:00 committed by GitHub
commit ae5ab4c394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 9 deletions

View File

@ -28,9 +28,6 @@ limitations under the License.
align-items: baseline; align-items: baseline;
flex-grow: 1; flex-grow: 1;
border: 1px solid $input-darker-bg-color;
border-radius: 8px;
> .mx_RadioButton_content { > .mx_RadioButton_content {
flex-grow: 1; flex-grow: 1;
@ -110,6 +107,11 @@ limitations under the License.
} }
} }
.mx_RadioButton_outlined {
border: 1px solid $input-darker-bg-color;
border-radius: 8px;
}
.mx_RadioButton_checked { .mx_RadioButton_checked {
border-color: $accent-color; border-color: $accent-color;
} }

View File

@ -193,6 +193,10 @@ limitations under the License.
.mx_EventTile_content { .mx_EventTile_content {
margin-right: 0; margin-right: 0;
} }
&.mx_AppearanceUserSettingsTab_Layout_RadioButton_selected {
border-color: $accent-color;
}
} }
.mx_RadioButton { .mx_RadioButton {

View File

@ -444,6 +444,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
value={CREATE_STORAGE_OPTION_KEY} value={CREATE_STORAGE_OPTION_KEY}
name="keyPassphrase" name="keyPassphrase"
checked={this.state.passPhraseKeySelected === CREATE_STORAGE_OPTION_KEY} checked={this.state.passPhraseKeySelected === CREATE_STORAGE_OPTION_KEY}
outlined
> >
<div className="mx_CreateSecretStorageDialog_optionTitle"> <div className="mx_CreateSecretStorageDialog_optionTitle">
<span className="mx_CreateSecretStorageDialog_optionIcon mx_CreateSecretStorageDialog_optionIcon_secureBackup"></span> <span className="mx_CreateSecretStorageDialog_optionIcon mx_CreateSecretStorageDialog_optionIcon_secureBackup"></span>
@ -456,6 +457,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
value={CREATE_STORAGE_OPTION_PASSPHRASE} value={CREATE_STORAGE_OPTION_PASSPHRASE}
name="keyPassphrase" name="keyPassphrase"
checked={this.state.passPhraseKeySelected === CREATE_STORAGE_OPTION_PASSPHRASE} checked={this.state.passPhraseKeySelected === CREATE_STORAGE_OPTION_PASSPHRASE}
outlined
> >
<div className="mx_CreateSecretStorageDialog_optionTitle"> <div className="mx_CreateSecretStorageDialog_optionTitle">
<span className="mx_CreateSecretStorageDialog_optionIcon mx_CreateSecretStorageDialog_optionIcon_securePhrase"></span> <span className="mx_CreateSecretStorageDialog_optionIcon mx_CreateSecretStorageDialog_optionIcon_securePhrase"></span>

View File

@ -18,6 +18,7 @@ import React from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
interface IProps extends React.InputHTMLAttributes<HTMLInputElement> { interface IProps extends React.InputHTMLAttributes<HTMLInputElement> {
outlined?: boolean;
} }
interface IState { interface IState {
@ -29,7 +30,7 @@ export default class StyledRadioButton extends React.PureComponent<IProps, IStat
}; };
public render() { public render() {
const { children, className, disabled, ...otherProps } = this.props; const { children, className, disabled, outlined, ...otherProps } = this.props;
const _className = classnames( const _className = classnames(
'mx_RadioButton', 'mx_RadioButton',
className, className,
@ -37,11 +38,12 @@ export default class StyledRadioButton extends React.PureComponent<IProps, IStat
"mx_RadioButton_disabled": disabled, "mx_RadioButton_disabled": disabled,
"mx_RadioButton_enabled": !disabled, "mx_RadioButton_enabled": !disabled,
"mx_RadioButton_checked": this.props.checked, "mx_RadioButton_checked": this.props.checked,
"mx_RadioButton_outlined": outlined,
}); });
return <label className={_className}> return <label className={_className}>
<input type='radio' disabled={disabled} {...otherProps} /> <input type='radio' disabled={disabled} {...otherProps} />
{/* Used to render the radio button circle */} {/* Used to render the radio button circle */}
<div><div></div></div> <div><div /></div>
<div className="mx_RadioButton_content">{children}</div> <div className="mx_RadioButton_content">{children}</div>
<div className="mx_RadioButton_spacer" /> <div className="mx_RadioButton_spacer" />
</label>; </label>;

View File

@ -32,10 +32,11 @@ interface IProps<T extends string> {
className?: string; className?: string;
definitions: IDefinition<T>[]; definitions: IDefinition<T>[];
value?: T; // if not provided no options will be selected value?: T; // if not provided no options will be selected
outlined?: boolean;
onChange(newValue: T); onChange(newValue: T);
} }
function StyledRadioGroup<T extends string>({name, definitions, value, className, onChange}: IProps<T>) { function StyledRadioGroup<T extends string>({name, definitions, value, className, outlined, onChange}: IProps<T>) {
const _onChange = e => { const _onChange = e => {
onChange(e.target.value); onChange(e.target.value);
}; };
@ -49,6 +50,7 @@ function StyledRadioGroup<T extends string>({name, definitions, value, className
name={name} name={name}
value={d.value} value={d.value}
disabled={d.disabled} disabled={d.disabled}
outlined={outlined}
> >
{d.label} {d.label}
</StyledRadioButton> </StyledRadioButton>

View File

@ -34,6 +34,7 @@ import SettingsFlag from '../../../elements/SettingsFlag';
import Field from '../../../elements/Field'; import Field from '../../../elements/Field';
import EventTilePreview from '../../../elements/EventTilePreview'; import EventTilePreview from '../../../elements/EventTilePreview';
import StyledRadioGroup from "../../../elements/StyledRadioGroup"; import StyledRadioGroup from "../../../elements/StyledRadioGroup";
import classNames from 'classnames';
interface IProps { interface IProps {
} }
@ -288,6 +289,7 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
}))} }))}
onChange={this.onThemeChange} onChange={this.onThemeChange}
value={this.state.useSystemTheme ? undefined : this.state.theme} value={this.state.useSystemTheme ? undefined : this.state.theme}
outlined
/> />
</div> </div>
{customThemeForm} {customThemeForm}
@ -342,8 +344,10 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
return <div className="mx_SettingsTab_section mx_AppearanceUserSettingsTab_Layout"> return <div className="mx_SettingsTab_section mx_AppearanceUserSettingsTab_Layout">
<span className="mx_SettingsTab_subheading">{_t("Message layout")}</span> <span className="mx_SettingsTab_subheading">{_t("Message layout")}</span>
<div className="mx_AppearanceUserSettingsTab_Layout_RadioButtons" > <div className="mx_AppearanceUserSettingsTab_Layout_RadioButtons">
<div className="mx_AppearanceUserSettingsTab_Layout_RadioButton"> <div className={classNames("mx_AppearanceUserSettingsTab_Layout_RadioButton", {
mx_AppearanceUserSettingsTab_Layout_RadioButton_selected: this.state.useIRCLayout,
})}>
<EventTilePreview <EventTilePreview
className="mx_AppearanceUserSettingsTab_Layout_RadioButton_preview" className="mx_AppearanceUserSettingsTab_Layout_RadioButton_preview"
message={this.MESSAGE_PREVIEW_TEXT} message={this.MESSAGE_PREVIEW_TEXT}
@ -359,7 +363,9 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
</StyledRadioButton> </StyledRadioButton>
</div> </div>
<div className="mx_AppearanceUserSettingsTab_spacer" /> <div className="mx_AppearanceUserSettingsTab_spacer" />
<div className="mx_AppearanceUserSettingsTab_Layout_RadioButton"> <div className={classNames("mx_AppearanceUserSettingsTab_Layout_RadioButton", {
mx_AppearanceUserSettingsTab_Layout_RadioButton_selected: !this.state.useIRCLayout,
})}>
<EventTilePreview <EventTilePreview
className="mx_AppearanceUserSettingsTab_Layout_RadioButton_preview" className="mx_AppearanceUserSettingsTab_Layout_RadioButton_preview"
message={this.MESSAGE_PREVIEW_TEXT} message={this.MESSAGE_PREVIEW_TEXT}