Fix code review issues

- interfaces go to the top
- fix comma conflation
- value no generic
- optionalised props
- line lints
This commit is contained in:
Jorik Schellekens 2020-06-10 14:11:36 +01:00
parent d6a532040e
commit 04d91ae0af
3 changed files with 91 additions and 93 deletions

View file

@ -15,10 +15,21 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { EventHandler } from "react";
import React from "react";
import classNames from "classnames";
import * as sdk from "../../../index";
interface IProps {
// Whether or not this toggle is in the 'on' position.
checked: boolean,
// Whether or not the user can interact with the switch
disabled: boolean,
// Called when the checked state changes. First argument will be the new state.
onChange(checked: boolean): void,
};
// Controlled Toggle Switch element, written with Accessibility in mind
export default ({checked, disabled = false, onChange, ...props}: IProps) => {
const _onClick = () => {
@ -45,14 +56,3 @@ export default ({checked, disabled = false, onChange, ...props}: IProps) => {
</AccessibleButton>
);
};
interface IProps {
// Whether or not this toggle is in the 'on' position.
checked: boolean,
// Whether or not the user can interact with the switch
disabled: boolean,
// Called when the checked state changes. First argument will be the new state.
onChange(checked: boolean): void,
};