diff --git a/src/containers/JsonEditor/ErrorContainer.tsx b/src/containers/JsonEditor/ErrorContainer.tsx index adbead1..dea47c6 100644 --- a/src/containers/JsonEditor/ErrorContainer.tsx +++ b/src/containers/JsonEditor/ErrorContainer.tsx @@ -4,6 +4,7 @@ import { MdExpandMore, MdExpandLess, MdReportGmailerrorred, + MdOutlineCheckCircleOutline, } from "react-icons/md"; export type Error = { @@ -18,18 +19,23 @@ interface ErrorContainerProps { const StyledErrorWrapper = styled.div``; -const StyledErrorHeader = styled.a` +const StyledErrorHeader = styled.button<{ error: boolean }>` display: flex; + width: 100%; + border-radius: 0; justify-content: space-between; align-items: center; background: ${({ theme }) => theme.BLACK_DARK}; - padding: 6px 12px; - color: ${({ theme }) => theme.DANGER}; - font-size: 22px; + padding: 4px 16px; + color: ${({ theme, error }) => (error ? theme.DANGER : theme.TEXT_POSITIVE)}; cursor: pointer; + height: 28px; + border-bottom: 1px solid #1f2124; + pointer-events: ${({ error }) => !error && "none"}; &:hover { color: ${({ theme }) => theme.DANGER}; + box-shadow: none; } `; @@ -37,15 +43,14 @@ const StyledTitle = styled.span` display: flex; justify-content: center; align-items: center; - font-weight: 600; + font-weight: 500; gap: 10px; + font-size: 16px; `; const StyledError = styled.pre` color: ${({ theme }) => theme.DANGER}; - border: 1px solid ${({ theme }) => theme.SILVER_DARK}; - border-left: none; - border-right: none; + border-bottom: 1px solid ${({ theme }) => theme.SILVER_DARK}; font-size: 12px; padding: 12px; margin: 0; @@ -60,20 +65,29 @@ export const ErrorContainer: React.FC = ({ return ( setError((err: Error) => ({ ...err, isExpanded: !err.isExpanded })) } > - Error + {error.message ? ( + + ) : ( + + )} + {error.message ? "Error" : "JSON Valid"} - {error.isExpanded ? ( - - ) : ( - - )} + {error.message && + (error.isExpanded ? ( + + ) : ( + + ))} - {error.isExpanded && {error.message}} + {error.isExpanded && error.message && ( + {error.message} + )} ); };