diff --git a/crabfit-frontend/src/components/Error/Error.tsx b/crabfit-frontend/src/components/Error/Error.tsx index 8046cbe..6cf8770 100644 --- a/crabfit-frontend/src/components/Error/Error.tsx +++ b/crabfit-frontend/src/components/Error/Error.tsx @@ -3,11 +3,12 @@ import { Wrapper, CloseButton } from './errorStyle'; const Error = ({ children, onClose, + open = true, ...props }) => ( - + {children} - + diff --git a/crabfit-frontend/src/components/Error/errorStyle.ts b/crabfit-frontend/src/components/Error/errorStyle.ts index c62e95a..5f0f667 100644 --- a/crabfit-frontend/src/components/Error/errorStyle.ts +++ b/crabfit-frontend/src/components/Error/errorStyle.ts @@ -1,7 +1,6 @@ import styled from '@emotion/styled'; export const Wrapper = styled.div` - margin: 20px 0; border-radius: 3px; background-color: ${props => props.theme.error}; color: #FFFFFF; @@ -10,6 +9,19 @@ export const Wrapper = styled.div` align-items: center; justify-content: space-between; font-size: 18px; + opacity: 0; + max-height: 0; + margin: 0; + visibility: hidden; + transition: margin .2s, max-height .2s; + + ${props => props.open && ` + opacity: 1; + visibility: visible; + margin: 20px 0; + max-height: 60px; + transition: opacity .15s .2s, max-height .2s, margin .2s, visibility .2s; + `} `; export const CloseButton = styled.button` diff --git a/crabfit-frontend/src/pages/Create/Create.tsx b/crabfit-frontend/src/pages/Create/Create.tsx index 5ce6b55..93d2cb4 100644 --- a/crabfit-frontend/src/pages/Create/Create.tsx +++ b/crabfit-frontend/src/pages/Create/Create.tsx @@ -229,9 +229,7 @@ const Create = ({ offline }) => { defaultOption={t('home:form.timezone.defaultOption')} /> - {error && ( - setError(null)}>{error} - )} + setError(null)}>{error} diff --git a/crabfit-frontend/src/pages/Event/Event.tsx b/crabfit-frontend/src/pages/Event/Event.tsx index 14b3e9e..6b64e8e 100644 --- a/crabfit-frontend/src/pages/Event/Event.tsx +++ b/crabfit-frontend/src/pages/Event/Event.tsx @@ -352,7 +352,7 @@ const Event = (props) => { buttonWidth={`${Math.max(t('event:form.button').length*11, 100)}px`} >{t('event:form.button')} - {error && setError(null)}>{error}} + setError(null)}>{error} {t('event:form.info')} )} diff --git a/crabfit-frontend/src/pages/Home/Home.tsx b/crabfit-frontend/src/pages/Home/Home.tsx index 5a135cc..3dec4fe 100644 --- a/crabfit-frontend/src/pages/Home/Home.tsx +++ b/crabfit-frontend/src/pages/Home/Home.tsx @@ -206,9 +206,7 @@ const Home = ({ offline }) => { defaultOption={t('home:form.timezone.defaultOption')} /> - {error && ( - setError(null)}>{error} - )} + setError(null)}>{error}