Skip to content

Commit f4293b4

Browse files
authored
Add titleNode prop to @jbrowse/core/ui/Dialog (#5039)
1 parent 717d9ba commit f4293b4

File tree

2 files changed

+294
-287
lines changed

2 files changed

+294
-287
lines changed

packages/core/ui/Dialog.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,40 @@ const useStyles = makeStyles()(theme => ({
2727
top: theme.spacing(1),
2828
color: theme.palette.grey[500],
2929
},
30+
errorBox: {
31+
width: 800,
32+
margin: 40,
33+
},
3034
}))
3135

3236
function DialogError({ error }: { error: unknown }) {
37+
const { classes } = useStyles()
3338
return (
34-
<div style={{ width: 800, margin: 40 }}>
39+
<div className={classes.errorBox}>
3540
<ErrorMessage error={error} />
3641
</div>
3742
)
3843
}
3944

4045
interface Props extends DialogProps {
4146
header?: React.ReactNode
47+
titleNode?: React.ReactNode
4248
}
4349

4450
const Dialog = observer(function (props: Props) {
4551
const { classes } = useStyles()
46-
const { title, header, children, onClose } = props
52+
const { titleNode, ...rest } = props
53+
const { title, header, children, onClose } = rest
4754
const theme = useTheme()
4855

4956
return (
50-
<MUIDialog {...props}>
57+
<MUIDialog {...rest}>
5158
<ScopedCssBaseline>
5259
{isValidElement(header) ? (
5360
header
5461
) : (
5562
<DialogTitle>
56-
<SanitizedHTML html={title || ''} />
63+
{titleNode || <SanitizedHTML html={title || ''} />}
5764
{onClose ? (
5865
<IconButton
5966
className={classes.closeButton}

0 commit comments

Comments
 (0)