1 | import React from "react";
|
2 | import styled from "styled-components";
|
3 | import { InfoCircleFilled } from "@ant-design/icons";
|
4 | const ColorTable = {
|
5 | red: {
|
6 | text: "#a50e0e",
|
7 | bg: "rgba(250, 219, 216, 0.4)",
|
8 | },
|
9 | yellow: {
|
10 | text: "#b05a00",
|
11 | bg: "rgba(250, 239, 204, 0.4)",
|
12 | },
|
13 | blue: {
|
14 | text: "#174ea6",
|
15 | bg: "rgba(207, 223, 250, 0.4)",
|
16 | },
|
17 | };
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | export default function ColorTip({ children, type = "blue", style }) {
|
26 | const config = ColorTable[type];
|
27 |
|
28 | return (
|
29 | <SBox bg={config.bg} style={style}>
|
30 | <SIcon>
|
31 | <InfoCircleFilled style={{ fontSize: "16px", color: config.text }} />
|
32 | </SIcon>
|
33 | <div style={{ color: config.text }}>{children}</div>
|
34 | </SBox>
|
35 | );
|
36 | }
|
37 |
|
38 | const SBox = styled.div`
|
39 | background-color: ${props => props.bg};
|
40 | padding: 10px;
|
41 | padding-left: 35px;
|
42 | position: relative;
|
43 | border-radius: 4px;
|
44 | margin: 10px auto;
|
45 | `;
|
46 |
|
47 | const SIcon = styled.div`
|
48 | position: absolute;
|
49 | left: 10px;
|
50 | top: 10px;
|
51 | `;
|