aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/ui/alert.tsx
blob: 54881b499b69e99e41a0a4a970ff4bf15758ed90 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import * as React from 'react';
import { AlertTypes } from 'ts/types';
import { colors } from 'ts/utils/colors';

interface AlertProps {
    type: AlertTypes;
    message: string | React.ReactNode;
}

export function Alert(props: AlertProps) {
    const isAlert = props.type === AlertTypes.ERROR;
    const errMsgStyles = {
        background: isAlert ? colors.red200 : colors.lightestGreen,
        color: colors.white,
        marginTop: 10,
        padding: 4,
        paddingLeft: 8,
    };

    return (
        <div className="rounded center" style={errMsgStyles}>
            {props.message}
        </div>
    );
}