Spaces:
Sleeping
Sleeping
File size: 1,039 Bytes
c40c75a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import React from "react";
import { Select } from "antd";
const { Option } = Select;
interface BudgetDurationDropdownProps {
value?: string | null;
onChange: (value: string) => void;
className?: string;
style?: React.CSSProperties;
}
const BudgetDurationDropdown: React.FC<BudgetDurationDropdownProps> = ({
value,
onChange,
className = "",
style = {}
}) => {
return (
<Select
style={{ width: '100%', ...style }}
value={value || undefined}
onChange={onChange}
className={className}
placeholder="n/a"
>
<Option value="24h">daily</Option>
<Option value="7d">weekly</Option>
<Option value="30d">monthly</Option>
</Select>
);
};
export const getBudgetDurationLabel = (value: string | null | undefined): string => {
if (!value) return "Not set";
const budgetDurationMap: Record<string, string> = {
"24h": "daily",
"7d": "weekly",
"30d": "monthly"
};
return budgetDurationMap[value] || value;
};
export default BudgetDurationDropdown; |