Skip to content

Instantly share code, notes, and snippets.

@jordyvandomselaar
Created July 23, 2021 21:38
Show Gist options
  • Save jordyvandomselaar/a2ab16c02d757ebf2c11211c360d21e0 to your computer and use it in GitHub Desktop.
Save jordyvandomselaar/a2ab16c02d757ebf2c11211c360d21e0 to your computer and use it in GitHub Desktop.
Notice
import styled from "styled-components";
interface NoticeProps {
variant: "hint" | "important";
}
const backgroundColors: { [key: string]: string } = {
hint: "#01920124",
important: "#ffff002e",
};
const borderColors: { [key: string]: string } = {
hint: "#01920161",
important: "#ffff0094",
};
const Notice = styled.div<NoticeProps>`
background-color: ${(props) => backgroundColors[props.variant]};
border-left: 9px solid ${(props) => borderColors[props.variant]};
padding: 10px;
p:first-child {
margin-top: 0;
}
p:last-child {
margin-bottom: 0;
}
`;
export default Notice;

import Notice from "relative/path/to/Notice";

Tip:

This is my tip to you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment