All files / src/components/error ErrorResult.tsx

0% Statements 0/27
100% Branches 1/1
100% Functions 1/1
0% Lines 0/27

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                                                                                                                                 
import { FC } from 'react';
import { ErrorResponse } from '../../models/errorResponse';
import { FiAlertOctagon } from 'react-icons/fi';
import styled from 'styled-components';
 
type Props = {
  result: ErrorResponse;
};
 
const StyledBox = styled.div`
  display: flex;
  flex-direction: column;
  justify-content: center;
`;
 
const StyledIconWrapper = styled.div`
  margin: 0 auto;
`;
 
const StyledMessage = styled.p`
  margin: 0;
  padding: 0;
  font-size: 1.6rem;
  text-align: center;
`;
 
const StyledErrorBox = styled.div`
  width: fit-content;
  margin: 30px auto 0 auto;
  padding: 5px 15px;
  background-color: #f6f6f6;
  border: 1px solid #b3b3b3;
`;
 
const StyledLabel = styled.p`
  font-size: 1.6rem;
  margin: 5px 0 0 0;
  padding: 0;
`;
 
const StyledError = styled.p`
  font-size: 1.6rem;
  margin: 0;
  padding: 0;
`;
 
const ErrorResult: FC<Props> = (props) => {
  return (
    <StyledBox>
      <StyledIconWrapper>
        <FiAlertOctagon size={90} color={'#d01c1c'} />
      </StyledIconWrapper>
      <StyledMessage>処理の実行に失敗しました。</StyledMessage>
      <StyledErrorBox>
        <StyledLabel>エラーコード</StyledLabel>
        <StyledError>{props.result.code}</StyledError>
        <StyledLabel>エラーメッセージ</StyledLabel>
        <StyledError>{props.result.message}</StyledError>
      </StyledErrorBox>
    </StyledBox>
  );
};
 
export default ErrorResult;