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