mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
|
// ui
|
||
|
import { CustomSelect } from "components/ui";
|
||
|
// types
|
||
|
import { IAnalyticsParams, TXAxisValues } from "types";
|
||
|
// constants
|
||
|
import { ANALYTICS_X_AXIS_VALUES } from "constants/analytics";
|
||
|
|
||
|
type Props = {
|
||
|
value: TXAxisValues | null | undefined;
|
||
|
onChange: () => void;
|
||
|
params: IAnalyticsParams;
|
||
|
};
|
||
|
|
||
|
export const SelectSegment: React.FC<Props> = ({ value, onChange, params }) => (
|
||
|
<CustomSelect
|
||
|
value={value}
|
||
|
label={
|
||
|
<span>
|
||
|
{ANALYTICS_X_AXIS_VALUES.find((v) => v.value === value)?.label ?? (
|
||
|
<span className="text-brand-secondary">No value</span>
|
||
|
)}
|
||
|
</span>
|
||
|
}
|
||
|
onChange={onChange}
|
||
|
width="w-full"
|
||
|
maxHeight="lg"
|
||
|
>
|
||
|
<CustomSelect.Option value={null}>No value</CustomSelect.Option>
|
||
|
{ANALYTICS_X_AXIS_VALUES.map((item) => {
|
||
|
if (params.x_axis === item.value) return null;
|
||
|
|
||
|
return (
|
||
|
<CustomSelect.Option key={item.value} value={item.value}>
|
||
|
{item.label}
|
||
|
</CustomSelect.Option>
|
||
|
);
|
||
|
})}
|
||
|
</CustomSelect>
|
||
|
);
|