Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix: react error on share dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
yaya-usman committed Mar 28, 2022
1 parent 1e060fe commit b479977
Showing 1 changed file with 35 additions and 30 deletions.
65 changes: 35 additions & 30 deletions src/components/views/elements/StyledCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

import React from "react";
import { randomString } from "matrix-js-sdk/src/randomstring";
import classnames from 'classnames';
import classnames from "classnames";

import { replaceableComponent } from "../../../utils/replaceableComponent";

Expand All @@ -31,11 +31,13 @@ interface IProps extends React.InputHTMLAttributes<HTMLInputElement> {
id?: string;
}

interface IState {
}
interface IState {}

@replaceableComponent("views.elements.StyledCheckbox")
export default class StyledCheckbox extends React.PureComponent<IProps, IState> {
export default class StyledCheckbox extends React.PureComponent<
IProps,
IState
> {
private id: string;

public static readonly defaultProps = {
Expand All @@ -50,33 +52,36 @@ export default class StyledCheckbox extends React.PureComponent<IProps, IState>

public render() {
/* eslint @typescript-eslint/no-unused-vars: ["error", { "ignoreRestSiblings": true }] */
const { children, className, kind = CheckboxStyle.Solid, inputRef, ...otherProps } = this.props;

const newClassName = classnames(
"mx_Checkbox",
const {
children,
className,
{
"mx_Checkbox_hasKind": kind,
[`mx_Checkbox_kind_${kind}`]: kind,
},
kind = CheckboxStyle.Solid,
inputRef,
...otherProps
} = this.props;

const newClassName = classnames("mx_Checkbox", className, {
mx_Checkbox_hasKind: kind,
[`mx_Checkbox_kind_${kind}`]: kind,
});
return (
<span className={newClassName}>
<input
// Pass through the ref - used for keyboard shortcut access to some buttons
ref={inputRef}
id={this.id}
{...otherProps}
type="checkbox"
readOnly
/>
<label htmlFor={this.id}>
{ /* Using the div to center the image */ }
<div className="mx_Checkbox_background">
<div className="mx_Checkbox_checkmark" />
</div>
<div>{ this.props.children }</div>
</label>
</span>
);
return <span className={newClassName}>
<input
// Pass through the ref - used for keyboard shortcut access to some buttons
ref={inputRef}
id={this.id}
{...otherProps}
type="checkbox"
/>
<label htmlFor={this.id}>
{ /* Using the div to center the image */ }
<div className="mx_Checkbox_background">
<div className="mx_Checkbox_checkmark" />
</div>
<div>
{ this.props.children }
</div>
</label>
</span>;
}
}

0 comments on commit b479977

Please sign in to comment.