@@ -16,7 +16,7 @@ limitations under the License.
1616
1717import React from "react" ;
1818import { randomString } from "matrix-js-sdk/src/randomstring" ;
19- import classnames from ' classnames' ;
19+ import classnames from " classnames" ;
2020
2121import { replaceableComponent } from "../../../utils/replaceableComponent" ;
2222
@@ -31,11 +31,13 @@ interface IProps extends React.InputHTMLAttributes<HTMLInputElement> {
3131 id ?: string ;
3232}
3333
34- interface IState {
35- }
34+ interface IState { }
3635
3736@replaceableComponent ( "views.elements.StyledCheckbox" )
38- export default class StyledCheckbox extends React . PureComponent < IProps , IState > {
37+ export default class StyledCheckbox extends React . PureComponent <
38+ IProps ,
39+ IState
40+ > {
3941 private id : string ;
4042
4143 public static readonly defaultProps = {
@@ -50,33 +52,36 @@ export default class StyledCheckbox extends React.PureComponent<IProps, IState>
5052
5153 public render ( ) {
5254 /* eslint @typescript-eslint/no-unused-vars: ["error", { "ignoreRestSiblings": true }] */
53- const { children, className, kind = CheckboxStyle . Solid , inputRef, ...otherProps } = this . props ;
54-
55- const newClassName = classnames (
56- "mx_Checkbox" ,
55+ const {
56+ children,
5757 className,
58- {
59- "mx_Checkbox_hasKind" : kind ,
60- [ `mx_Checkbox_kind_${ kind } ` ] : kind ,
61- } ,
58+ kind = CheckboxStyle . Solid ,
59+ inputRef,
60+ ...otherProps
61+ } = this . props ;
62+
63+ const newClassName = classnames ( "mx_Checkbox" , className , {
64+ mx_Checkbox_hasKind : kind ,
65+ [ `mx_Checkbox_kind_${ kind } ` ] : kind ,
66+ } ) ;
67+ return (
68+ < span className = { newClassName } >
69+ < input
70+ // Pass through the ref - used for keyboard shortcut access to some buttons
71+ ref = { inputRef }
72+ id = { this . id }
73+ { ...otherProps }
74+ type = "checkbox"
75+ readOnly
76+ />
77+ < label htmlFor = { this . id } >
78+ { /* Using the div to center the image */ }
79+ < div className = "mx_Checkbox_background" >
80+ < div className = "mx_Checkbox_checkmark" />
81+ </ div >
82+ < div > { this . props . children } </ div >
83+ </ label >
84+ </ span >
6285 ) ;
63- return < span className = { newClassName } >
64- < input
65- // Pass through the ref - used for keyboard shortcut access to some buttons
66- ref = { inputRef }
67- id = { this . id }
68- { ...otherProps }
69- type = "checkbox"
70- />
71- < label htmlFor = { this . id } >
72- { /* Using the div to center the image */ }
73- < div className = "mx_Checkbox_background" >
74- < div className = "mx_Checkbox_checkmark" />
75- </ div >
76- < div >
77- { this . props . children }
78- </ div >
79- </ label >
80- </ span > ;
8186 }
8287}
0 commit comments