UNPKG

@jbrowse/plugin-linear-genome-view

Version:

JBrowse 2 linear genome view

27 lines (26 loc) 1.72 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useState } from 'react'; import { Dialog } from '@jbrowse/core/ui'; import { Button, DialogActions, DialogContent, TextField, Typography, } from '@mui/material'; import { observer } from 'mobx-react'; import { makeStyles } from 'tss-react/mui'; const useStyles = makeStyles()({ root: { width: 500, }, }); const SetMaxHeightDialog = observer(function ({ model, handleClose, }) { const { classes } = useStyles(); const { maxHeight = '' } = model; const [max, setMax] = useState(`${maxHeight}`); const ok = max !== '' && !Number.isNaN(+max); return (_jsxs(Dialog, { open: true, onClose: handleClose, title: "Set max height", children: [_jsxs(DialogContent, { className: classes.root, children: [_jsx(Typography, { children: "Set max height for the track. For example, you can increase this if the layout says \"Max height reached\"" }), _jsx(TextField, { value: max, onChange: event => { setMax(event.target.value); }, placeholder: "Enter max score" }), !ok ? _jsx("div", { style: { color: 'red' }, children: "Invalid number" }) : null] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, disabled: !ok, onClick: () => { model.setMaxHeight(+max); handleClose(); }, children: "Submit" }), _jsx(Button, { variant: "contained", color: "secondary", onClick: () => { handleClose(); }, children: "Cancel" })] })] })); }); export default SetMaxHeightDialog;