21720: implemented CustomStyleRulesCallback and replaced everywhere
[arvados.git] / services / workbench2 / src / components / warning-collection / warning-collection.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import React from "react";
6 import { WarningIcon } from "components/icon/icon";
7 import { CustomStyleRulesCallback } from 'common/custom-theme';
8 import { DialogContentText, WithStyles, withStyles } from "@material-ui/core";
9 import { ArvadosTheme } from 'common/custom-theme';
10
11 type CssRules = 'container' | 'text';
12
13 const styles: CustomStyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
14     container: {
15         display: 'flex',
16         alignItems: 'center',
17     },
18     text: {
19         paddingLeft: '8px'
20     }
21 });
22
23 interface WarningCollectionProps {
24     text: string;
25 }
26
27 export const WarningCollection = withStyles(styles)(({ classes, text }: WarningCollectionProps & WithStyles<CssRules>) =>
28     <span className={classes.container}>
29         <WarningIcon />
30         <DialogContentText className={classes.text}>{text}</DialogContentText>
31     </span>);