Add label to currency select

This commit is contained in:
Brenda Sukh
2020-11-16 17:34:35 -05:00
parent 885526474e
commit 7cfabd4d51
@@ -15,7 +15,13 @@
*/
import React from 'react';
import { MenuItem, Select, SelectProps } from '@material-ui/core';
import {
InputLabel,
FormControl,
MenuItem,
Select,
SelectProps,
} from '@material-ui/core';
import { Currency, CurrencyType } from '../../types';
import { findAlways } from '../../utils/assert';
import { useSelectStyles as useStyles } from '../../utils/styles';
@@ -51,24 +57,28 @@ export const CurrencySelect = ({
};
return (
<Select
className={classes.select}
variant="outlined"
onChange={handleOnChange}
value={currency.kind || NULL_VALUE}
renderValue={renderValue}
>
{currencies.map((c: Currency) => (
<MenuItem
className={classes.menuItem}
key={c.kind || NULL_VALUE}
value={c.kind || NULL_VALUE}
>
<span role="img" aria-label={c.label}>
{c.label}
</span>
</MenuItem>
))}
</Select>
<FormControl variant="outlined">
<InputLabel shrink>Convert to:</InputLabel>
<Select
className={classes.select}
variant="outlined"
labelWidth={100}
onChange={handleOnChange}
value={currency.kind || NULL_VALUE}
renderValue={renderValue}
>
{currencies.map((c: Currency) => (
<MenuItem
className={classes.menuItem}
key={c.kind || NULL_VALUE}
value={c.kind || NULL_VALUE}
>
<span role="img" aria-label={c.label}>
{c.label}
</span>
</MenuItem>
))}
</Select>
</FormControl>
);
};