-
Notifications
You must be signed in to change notification settings - Fork 213
/
Copy pathDot.tsx
35 lines (32 loc) · 893 Bytes
/
Dot.tsx
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
import React from 'react';
import styled from 'styled-components';
import { Checkmark } from 'grommet-icons';
import { Close } from 'grommet-icons';
interface DotProps {
theme?: any;
success?: boolean;
error?: boolean;
width?: number;
height?: number;
className?: string;
}
const StyledDiv = styled.div`
width: ${(p: DotProps) => p.width || 20}px;
height: ${(p: DotProps) => p.height || 20}px;
padding: 8px;
display: flex;
align-items: center;
justify-content: center;
background: ${(p: DotProps) => {
if (p.success) return p.theme.green.dark;
if (p.error) return p.theme.red.medium;
return p.theme.gray.light;
}};
border-radius: 50%;
`;
export const Dot = (props: DotProps) => (
<StyledDiv {...props}>
{props.success && <Checkmark size="small" color="white" />}
{!props.success && <Close size="small" color="white" />}
</StyledDiv>
);