All files / client/src/components RaisedCard.tsx

87.5% Statements 7/8
100% Branches 5/5
83.33% Functions 5/6
87.5% Lines 7/8

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                              1x                                 1x           5338x   5338x 5338x     5338x     5338x      
import { ReactElement, ReactNode } from "react";
import styled from "styled-components";
import {
  HighlightStyle,
  getHighlightColor,
} from "client/components/componentStyles";
 
interface Props {
  children: ReactNode;
  className?: string;
  "data-testid"?: string;
  isHighlighted?: boolean;
  highlightStyle?: HighlightStyle;
}
 
export const RaisedCard = ({
  children,
  className,
  "data-testid": dataTestId,
  isHighlighted = false,
  highlightStyle,
}: Props): ReactElement => (
  <Card
    className={className}
    data-testid={dataTestId}
    $isHighlighted={isHighlighted}
    $highlightStyle={highlightStyle}
  >
    {children}
  </Card>
);
 
const Card = styled.div<{
  $isHighlighted: boolean;
  $highlightStyle?: HighlightStyle;
}>`
  margin: 20px 0 20px 0;
  padding: 12px 8px 12px 8px;
  border: 1px solid ${(props) => props.theme.borderCard};
  border-radius: 4px;
  background: ${(props) => props.theme.backgroundCard};
  box-shadow: ${(props) => props.theme.shadowLower};
 
  ${(props) =>
    props.$isHighlighted &&
    `border: 1px solid ${getHighlightColor(props.theme, props.$highlightStyle)};`}
  ${(props) =>
    props.$isHighlighted &&
    `border-left: 5px solid ${getHighlightColor(props.theme, props.$highlightStyle)};`}
`;