diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-14 19:04:32 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-14 19:04:32 -0700 |
commit | 9027b70996d2c39e51dee1e3fc9b55336c480a60 (patch) | |
tree | 38643907d099ae88a32617c0995b1ee96908c435 /modern/src/reports/components/ColumnSelect.js | |
parent | 072a70f8b30f1e2839da58116133f1f629ab8209 (diff) | |
download | trackermap-web-9027b70996d2c39e51dee1e3fc9b55336c480a60.tar.gz trackermap-web-9027b70996d2c39e51dee1e3fc9b55336c480a60.tar.bz2 trackermap-web-9027b70996d2c39e51dee1e3fc9b55336c480a60.zip |
Extract column select component
Diffstat (limited to 'modern/src/reports/components/ColumnSelect.js')
-rw-r--r-- | modern/src/reports/components/ColumnSelect.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/modern/src/reports/components/ColumnSelect.js b/modern/src/reports/components/ColumnSelect.js new file mode 100644 index 00000000..98e97420 --- /dev/null +++ b/modern/src/reports/components/ColumnSelect.js @@ -0,0 +1,27 @@ +import { useTranslation } from "../../common/components/LocalizationProvider"; +import { useFilterStyles } from "./ReportFilter"; + +const ColumnSelect = ({ columns, setColumns, columnsArray }) => { + const classes = useFilterStyles(); + const t = useTranslation(); + + return ( + <div className={classes.item}> + <FormControl variant="filled" fullWidth> + <InputLabel>{t('sharedColumns')}</InputLabel> + <Select + value={columns} + onChange={(e) => setColumns(e.target.value)} + renderValue={(it) => it.length} + multiple + > + {columnsArray.map(([key, string]) => ( + <MenuItem value={key}>{t(string)}</MenuItem> + ))} + </Select> + </FormControl> + </div> + ); +}; + +export default ColumnSelect; |