TimelineDataDescription optional onClick

Summary: Make this property optional as is not always required to implement it, if not needed.

Reviewed By: mweststrate

Differential Revision: D43948425

fbshipit-source-id: 43ed761c70c4779134f277a4cda53c1e3d326cb8
This commit is contained in:
Lorenzo Blasa
2023-03-10 06:18:21 -08:00
committed by Facebook GitHub Bot
parent d349135683
commit b4f6f9f008

View File

@@ -30,7 +30,7 @@ type Timeline = {
type Props = { type Props = {
canSetCurrent?: boolean; canSetCurrent?: boolean;
timeline: Timeline; timeline: Timeline;
onClick: (selected: string) => void; onClick?: (selected: string) => void;
}; };
type State = { type State = {
@@ -59,7 +59,7 @@ export class TimelineDataDescription extends Component<Props, State> {
{this.props.canSetCurrent && ( {this.props.canSetCurrent && (
<div> <div>
<Button <Button
onClick={() => this.props.onClick(this.state.selected)} onClick={() => this.props.onClick?.(this.state.selected)}
disabled={this.state.selected === this.props.timeline.current}> disabled={this.state.selected === this.props.timeline.current}>
Set as current Set as current
</Button> </Button>