forked from equinor/webviz
-
Notifications
You must be signed in to change notification settings - Fork 0
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
fe563a4
commit 46088c7
Showing
8 changed files
with
57 additions
and
22 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
33 changes: 33 additions & 0 deletions
33
frontend/src/modules/InplaceVolumetricsNew/components/filterSelect.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,33 @@ | ||
import React from "react"; | ||
|
||
import { Label } from "@lib/components/Label"; | ||
import { Select, SelectOption } from "@lib/components/Select"; | ||
import { useValidState } from "@lib/hooks/useValidState"; | ||
|
||
export type FilterSelectProps = { | ||
name: string; | ||
options: string[]; | ||
size: number; | ||
onChange?: (value: string) => void; | ||
}; | ||
|
||
export const FilterSelect: React.FC<FilterSelectProps> = (props) => { | ||
const [value, setValue] = useValidState<string>("", props.options); | ||
|
||
const selectOptions = props.options.map((option) => ({ value: `${option}`, label: `${option}` })); | ||
|
||
function handleSelectionChange(values: string[]) { | ||
setValue(values[0]); | ||
if (props.onChange) { | ||
props.onChange(values[0]); | ||
} | ||
} | ||
|
||
return ( | ||
<Label text={props.name}> | ||
<Select options={selectOptions} size={props.size} value={[value]} onChange={handleSelectionChange} /> | ||
</Label> | ||
); | ||
}; | ||
|
||
export default FilterSelect; |
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