ref(ui-components) Replace Recording dialog switch with new component (#11963)

The additional component is needed because the dialog is shared between native and web
This commit is contained in:
Robert Pintilii 2022-08-04 11:32:00 +03:00 committed by GitHub
parent 002d0fed42
commit 0fa0e99ffa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 17 deletions

View File

@ -1,14 +1,8 @@
/* @flow */
import Toggle from '@atlaskit/toggle';
import React, { Component } from 'react';
type Props = {|
import UISwitch from '../../../ui/components/web/Switch';
/**
* ID of the toggle.
*/
id: string,
type Props = {
/**
* CSS class name.
@ -20,16 +14,21 @@ type Props = {|
*/
disabled: boolean,
/**
* ID of the toggle.
*/
id: string,
/**
* Handler called when the user presses the switch.
*/
onValueChange: Function,
onValueChange: (checked?: boolean) => void,
/**
* The current value.
*/
value: boolean
|};
};
/**
* Renders a boolean input.
@ -51,16 +50,12 @@ export default class Switch extends Component<Props> {
...props
} = this.props;
// TODO: onChange will be called with parameter Event. It will be good
// if we translate it to calling the onValueChange with the value as a
// parameter to match the native implementation.
return (
<div className = { className }>
<Toggle
<UISwitch
checked = { value }
disabled = { disabled }
id = { id }
isChecked = { value }
isDisabled = { disabled }
onChange = { onValueChange }
{ ...props } />
</div>