-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9431bc
commit b4924ad
Showing
12 changed files
with
366 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
ui/src/timeMachine/components/builderCard/BuilderCardDropdownHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Libraries | ||
import React, {PureComponent} from 'react' | ||
|
||
import {SelectDropdown} from '@influxdata/clockface' | ||
import {BuilderAggregateFunctionType} from 'src/types' | ||
|
||
interface Props { | ||
options: string[] | ||
selectedOption: string | ||
testID: string | ||
onSelect?: (option: BuilderAggregateFunctionType) => void | ||
onDelete?: () => void | ||
} | ||
|
||
const emptyFunction = () => {} | ||
|
||
export default class BuilderCardDropdownHeader extends PureComponent<Props> { | ||
public static defaultProps = { | ||
testID: 'builder-card--header', | ||
} | ||
|
||
public render() { | ||
const {children, options, onSelect, selectedOption, testID} = this.props | ||
|
||
return ( | ||
<div className="builder-card--header" data-testid={testID}> | ||
<SelectDropdown | ||
options={options} | ||
selectedOption={selectedOption} | ||
testID="select-option-dropdown" | ||
onSelect={onSelect ? onSelect : emptyFunction} | ||
/> | ||
|
||
{children} | ||
{this.deleteButton} | ||
</div> | ||
) | ||
} | ||
|
||
private get deleteButton(): JSX.Element | undefined { | ||
const {onDelete} = this.props | ||
|
||
if (onDelete) { | ||
return <div className="builder-card--delete" onClick={onDelete} /> | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.