aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components/sliding_error.tsx
blob: 0237fb7e9d79731082fd81ad16e5069b759ec95c (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
26
27
28
29
30
31
32
33
34
35
36
import * as React from 'react';

import { ColorOption } from '../style/theme';

import { SlideUpAndDownAnimation } from './animations/slide_up_and_down_animation';

import { Container, Text } from './ui';

export interface ErrorProps {
    icon: string;
    message: string;
}

export const Error: React.StatelessComponent<ErrorProps> = props => (
    <Container
        padding="10px"
        border={`1px solid ${ColorOption.darkOrange}`}
        backgroundColor={ColorOption.lightOrange}
        width="100%"
        borderRadius="6px"
        marginBottom="10px"
    >
        <Container marginRight="5px" display="inline">
            {props.icon}
        </Container>
        <Text fontWeight="500" fontColor={ColorOption.darkOrange}>
            {props.message}
        </Text>
    </Container>
);

export const SlidingError: React.StatelessComponent<ErrorProps> = props => (
    <SlideUpAndDownAnimation downY="120px" delayMs={5000}>
        <Error icon={props.icon} message={props.message} />
    </SlideUpAndDownAnimation>
);