mirror of
https://github.com/umami-software/umami.git
synced 2026-02-05 21:27:20 +01:00
Updates to Revenue report.
This commit is contained in:
parent
4995a0e1e4
commit
095d1f2070
19 changed files with 365 additions and 416 deletions
34
src/components/input/CurrencySelect.tsx
Normal file
34
src/components/input/CurrencySelect.tsx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { CURRENCIES } from '@/lib/constants';
|
||||
import { ListItem, Select } from '@umami/react-zen';
|
||||
import { useState } from 'react';
|
||||
import { useMessages } from '@/components/hooks';
|
||||
|
||||
export function CurrencySelect({ value, onChange }) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const [search, setSearch] = useState('');
|
||||
|
||||
return (
|
||||
<Select
|
||||
items={CURRENCIES}
|
||||
label={formatMessage(labels.currency)}
|
||||
value={value}
|
||||
defaultValue={value}
|
||||
onChange={onChange}
|
||||
listProps={{ style: { maxHeight: '300px' } }}
|
||||
onSearch={setSearch}
|
||||
allowSearch
|
||||
>
|
||||
{CURRENCIES.map(({ id, name }) => {
|
||||
if (search && !`${id}${name}`.toLowerCase().includes(search)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<ListItem key={id} id={id}>
|
||||
{id} — {name}
|
||||
</ListItem>
|
||||
);
|
||||
}).filter(n => n)}
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue