2021-07-01 17:36:34 +01:00
|
|
|
import { InfoCircle } from "@styled-icons/boxicons-regular";
|
2021-07-05 11:23:23 +01:00
|
|
|
import styled, { css } from "styled-components";
|
|
|
|
|
|
|
|
import { Children } from "../../types/Preact";
|
2021-07-01 17:36:34 +01:00
|
|
|
|
|
|
|
interface Props {
|
2021-07-05 11:25:20 +01:00
|
|
|
warning?: boolean;
|
|
|
|
error?: boolean;
|
2021-07-01 17:36:34 +01:00
|
|
|
}
|
2021-06-18 14:20:57 +01:00
|
|
|
|
2021-07-04 20:15:38 +02:00
|
|
|
export const Separator = styled.div<Props>`
|
2021-07-05 11:25:20 +01:00
|
|
|
height: 1px;
|
|
|
|
width: calc(100% - 10px);
|
|
|
|
background: var(--secondary-header);
|
|
|
|
margin: 18px auto;
|
2021-07-04 20:15:38 +02:00
|
|
|
`;
|
|
|
|
|
2021-07-01 17:36:34 +01:00
|
|
|
export const TipBase = styled.div<Props>`
|
2021-07-05 11:25:20 +01:00
|
|
|
display: flex;
|
|
|
|
padding: 12px;
|
|
|
|
overflow: hidden;
|
|
|
|
align-items: center;
|
2021-06-18 14:20:57 +01:00
|
|
|
|
2021-07-05 11:25:20 +01:00
|
|
|
font-size: 14px;
|
|
|
|
border-radius: 7px;
|
|
|
|
background: var(--primary-header);
|
|
|
|
border: 2px solid var(--secondary-header);
|
2021-06-18 14:20:57 +01:00
|
|
|
|
2021-07-05 11:25:20 +01:00
|
|
|
a {
|
|
|
|
cursor: pointer;
|
|
|
|
&:hover {
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
}
|
2021-06-18 15:57:08 +01:00
|
|
|
|
2021-07-05 11:25:20 +01:00
|
|
|
svg {
|
|
|
|
flex-shrink: 0;
|
|
|
|
margin-inline-end: 10px;
|
|
|
|
}
|
2021-07-01 17:36:34 +01:00
|
|
|
|
2021-07-05 11:25:20 +01:00
|
|
|
${(props) =>
|
|
|
|
props.warning &&
|
|
|
|
css`
|
|
|
|
color: var(--warning);
|
|
|
|
border: 2px solid var(--warning);
|
|
|
|
background: var(--secondary-header);
|
|
|
|
`}
|
2021-07-01 17:36:34 +01:00
|
|
|
|
2021-07-05 11:25:20 +01:00
|
|
|
${(props) =>
|
|
|
|
props.error &&
|
|
|
|
css`
|
|
|
|
color: var(--error);
|
|
|
|
border: 2px solid var(--error);
|
|
|
|
background: var(--secondary-header);
|
|
|
|
`}
|
2021-06-18 14:20:57 +01:00
|
|
|
`;
|
|
|
|
|
2021-07-01 17:36:34 +01:00
|
|
|
export default function Tip(props: Props & { children: Children }) {
|
2021-07-05 11:25:20 +01:00
|
|
|
const { children, ...tipProps } = props;
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Separator />
|
|
|
|
<TipBase {...tipProps}>
|
|
|
|
<InfoCircle size={20} />
|
|
|
|
<span>{props.children}</span>
|
|
|
|
</TipBase>
|
|
|
|
</>
|
|
|
|
);
|
2021-06-18 14:20:57 +01:00
|
|
|
}
|