|
|
@ -2,15 +2,17 @@
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
|
|
|
|
import * as React from 'react';
|
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
import Color from 'color';
|
|
|
|
|
|
|
|
|
|
|
|
import { Theme, withTheme } from '@material-ui/core/styles';
|
|
|
|
import { Theme, withTheme } from '@material-ui/core/styles';
|
|
|
|
|
|
|
|
|
|
|
|
export default withTheme((props: {text: string, backgroundColor?: string, children?: any, theme: Theme}) => {
|
|
|
|
export default withTheme((props: {text: string, backgroundColor?: string, children?: any, theme: Theme}) => {
|
|
|
|
|
|
|
|
const backgroundColor = props.backgroundColor ?? props.theme.palette.secondary.main;
|
|
|
|
|
|
|
|
const foregroundColor = props.theme.palette.getContrastText(Color(backgroundColor).rgb().string());
|
|
|
|
const style = {
|
|
|
|
const style = {
|
|
|
|
header: {
|
|
|
|
header: {
|
|
|
|
backgroundColor: (props.backgroundColor !== undefined) ?
|
|
|
|
backgroundColor,
|
|
|
|
props.backgroundColor : props.theme.palette.secondary.main,
|
|
|
|
color: foregroundColor,
|
|
|
|
color: props.theme.palette.secondary.contrastText,
|
|
|
|
|
|
|
|
padding: 15,
|
|
|
|
padding: 15,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
headerText: {
|
|
|
|
headerText: {
|
|
|
|