All files / src/components/ui/buttons LabelButton.tsx

0% Statements 0/9
0% Branches 0/16
0% Functions 0/3
0% Lines 0/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78                                                                                                                                                           
import styled from "styled-components";
 
interface LabelButtonProps {
  color?: string;
  onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
}
 
interface LabelColorProps {
  color?: string;
}
 
const colors: Record<string, string> = {
  red: "#e20e2b",
  orange: "#ff5722",
  yellow: "#ffc107",
  green: "#4caf50",
  blue: "#03a9f4",
  purple: "#9c27b0",
  gray: "#9e9e9e",
};
 
const textColors: Record<string, string> = {
  red: "#ffffff",
  orange: "#ffffff",
  yellow: "#000000",
  green: "#ffffff",
  blue: "#ffffff",
  purple: "#ffffff",
  gray: "#ffffff",
};
 
export const LabelButton = styled.button.attrs<LabelButtonProps>((props) => ({
  style: {
    backgroundColor: colors[props.color || ""],
    border: `2px solid ${colors[props.color || ""] || props.theme.colors.text}`,
  },
  title: props.color,
}))`
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 20px;
  background-color: transparent;
  opacity: 0.9;
 
  &:hover {
    opacity: 1;
    transform: scale(1.25);
  }
`;
 
export const LabelColor = styled.div.attrs<LabelColorProps>((props) => ({
  style: {
    backgroundColor: colors[props.color || ""],
    border: `2px solid ${colors[props.color || ""] || props.theme.colors.text}`,
  },
  title: props.color,
}))`
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 20px;
  background-color: transparent;
  opacity: 0.9;
`;
 
export const LabelSpan = styled.span.attrs<LabelColorProps>((props) => ({
  style: {
    backgroundColor: colors[props.color || ""],
    color: textColors[props.color || ""],
  },
}))`
  border-radius: 32px;
  background-color: transparent;
  padding: 2px 10px;
  opacity: 0.8;
`;