Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import React from "react";
|
||||
import classnames from "classnames";
|
||||
|
||||
interface IProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
||||
inputRef?: React.RefObject<HTMLInputElement>;
|
||||
|
@ -26,53 +26,55 @@ interface IProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|||
childrenInLabel?: boolean;
|
||||
}
|
||||
|
||||
interface IState {
|
||||
}
|
||||
interface IState {}
|
||||
|
||||
export default class StyledRadioButton extends React.PureComponent<IProps, IState> {
|
||||
public static readonly defaultProps = {
|
||||
className: '',
|
||||
className: "",
|
||||
childrenInLabel: true,
|
||||
};
|
||||
|
||||
public render() {
|
||||
const { children, className, disabled, outlined, childrenInLabel, inputRef, ...otherProps } = this.props;
|
||||
const _className = classnames(
|
||||
'mx_StyledRadioButton',
|
||||
className,
|
||||
{
|
||||
"mx_StyledRadioButton_disabled": disabled,
|
||||
"mx_StyledRadioButton_enabled": !disabled,
|
||||
"mx_StyledRadioButton_checked": this.props.checked,
|
||||
"mx_StyledRadioButton_outlined": outlined,
|
||||
});
|
||||
const _className = classnames("mx_StyledRadioButton", className, {
|
||||
mx_StyledRadioButton_disabled: disabled,
|
||||
mx_StyledRadioButton_enabled: !disabled,
|
||||
mx_StyledRadioButton_checked: this.props.checked,
|
||||
mx_StyledRadioButton_outlined: outlined,
|
||||
});
|
||||
|
||||
const radioButton = <React.Fragment>
|
||||
<input
|
||||
// Pass through the ref - used for keyboard shortcut access to some buttons
|
||||
ref={inputRef}
|
||||
type='radio'
|
||||
disabled={disabled}
|
||||
{...otherProps}
|
||||
/>
|
||||
{ /* Used to render the radio button circle */ }
|
||||
<div><div /></div>
|
||||
</React.Fragment>;
|
||||
const radioButton = (
|
||||
<React.Fragment>
|
||||
<input
|
||||
// Pass through the ref - used for keyboard shortcut access to some buttons
|
||||
ref={inputRef}
|
||||
type="radio"
|
||||
disabled={disabled}
|
||||
{...otherProps}
|
||||
/>
|
||||
{/* Used to render the radio button circle */}
|
||||
<div>
|
||||
<div />
|
||||
</div>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
if (childrenInLabel) {
|
||||
return <label className={_className}>
|
||||
{ radioButton }
|
||||
<div className="mx_StyledRadioButton_content">{ children }</div>
|
||||
<div className="mx_StyledRadioButton_spacer" />
|
||||
</label>;
|
||||
} else {
|
||||
return <div className={_className}>
|
||||
<label className="mx_StyledRadioButton_innerLabel">
|
||||
{ radioButton }
|
||||
return (
|
||||
<label className={_className}>
|
||||
{radioButton}
|
||||
<div className="mx_StyledRadioButton_content">{children}</div>
|
||||
<div className="mx_StyledRadioButton_spacer" />
|
||||
</label>
|
||||
<div className="mx_StyledRadioButton_content">{ children }</div>
|
||||
<div className="mx_StyledRadioButton_spacer" />
|
||||
</div>;
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<div className={_className}>
|
||||
<label className="mx_StyledRadioButton_innerLabel">{radioButton}</label>
|
||||
<div className="mx_StyledRadioButton_content">{children}</div>
|
||||
<div className="mx_StyledRadioButton_spacer" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue