All files / client/src/components Checkbox.tsx

80% Statements 4/5
100% Branches 0/0
100% Functions 2/2
80% Lines 4/5

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                520x                 1x         1x         2529x        
import { InputHTMLAttributes, ReactElement } from "react";
import styled from "styled-components";
 
type Props = InputHTMLAttributes<HTMLInputElement> & {
  label: string;
  id: string;
};
 
export const Checkbox = (props: Props): ReactElement => {
  return (
    <Container>
      <StyledCheckbox {...props} type={"checkbox"} />
      <label htmlFor={props.id}>{props.label}</label>
    </Container>
  );
};
 
const Container = styled.div`
  display: flex;
  align-items: flex-start;
`;
 
const StyledCheckbox = styled.input`
  flex-shrink: 0;
  margin-top: 2px;
  margin-left: 4px;
  margin-right: 12px;
  accent-color: ${(props) => props.theme.formAccent};
  transform: scale(1.4);
  transform-origin: left;
`;