%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emergentqj/actioncivile/pre-auth/.8352c036a19b0051d0217d27d25e3f4a/static/js/common/components/AlertModal/
Upload File :
Create Path :
Current File : /home/emergentqj/actioncivile/pre-auth/.8352c036a19b0051d0217d27d25e3f4a/static/js/common/components/AlertModal/Alert.jsx

import React from "react";
import PropTypes from "prop-types";
import successIcon from "assets/images/check-circle-green.svg";
import errorIcon from "assets/images/errorIcon.svg";
import {
  Text, TEXT_KINDS, TEXT_SIZES, TEXT_ALIGNMENT,
} from "../Text";
import {
  ImageRow, StyledImg, StyledGrid, Wrapper,
} from "./Alert.styles";

function Alert({ defaultValue }) {
  const { type, text1, text2 } = defaultValue;

  return (
    <Wrapper>
      <StyledGrid container>
        <StyledGrid item md={12} sm={12}>
          <ImageRow>
            {type === "success" && (
              <StyledImg src={successIcon} alt="success" />
            )}
            {type === "error" && <StyledImg src={errorIcon} alt="error" />}
          </ImageRow>
        </StyledGrid>
        <StyledGrid item md={12} sm={12}>
          <Text
            kind={TEXT_KINDS.BODY}
            size={TEXT_SIZES.MEDIUM}
            alignment={TEXT_ALIGNMENT.CENTER}
          >
            {text1}
          </Text>
        </StyledGrid>
        {text2 && (
          <StyledGrid item md={12} sm={12}>
            <Text
              kind={TEXT_KINDS.BODY}
              size={TEXT_SIZES.MEDIUM}
              alignment={TEXT_ALIGNMENT.CENTER}
            >
              {text2}
            </Text>
          </StyledGrid>
        )}
      </StyledGrid>
    </Wrapper>
  );
}

Alert.propTypes = {
  defaultValue: PropTypes.shape({
    type: PropTypes.oneOf(["error", "success"]),
    text1: PropTypes.string,
    text2: PropTypes.string,
  }),
};

Alert.defaultProps = {
  defaultValue: {
    type: "success",
    text1: null,
    text2: null,
  },
};

export default Alert;

Zerion Mini Shell 1.0