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:
parent
002d0fed42
commit
0fa0e99ffa
|
@ -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>
|
Loading…
Reference in New Issue