%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/.632e77b3fb93bc8da5b589b869bc0037/static/js/common/components/AlertModal/ |
Current File : /home/emergentqj/actioncivile/pre-auth/.632e77b3fb93bc8da5b589b869bc0037/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;