Animate errors
This commit is contained in:
parent
02adb1e380
commit
eb449b6841
|
|
@ -3,11 +3,12 @@ import { Wrapper, CloseButton } from './errorStyle';
|
||||||
const Error = ({
|
const Error = ({
|
||||||
children,
|
children,
|
||||||
onClose,
|
onClose,
|
||||||
|
open = true,
|
||||||
...props
|
...props
|
||||||
}) => (
|
}) => (
|
||||||
<Wrapper {...props}>
|
<Wrapper open={open} {...props}>
|
||||||
{children}
|
{children}
|
||||||
<CloseButton type="button" onClick={onClose}>
|
<CloseButton type="button" onClick={onClose} title="Close error">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
|
||||||
</CloseButton>
|
</CloseButton>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
export const Wrapper = styled.div`
|
export const Wrapper = styled.div`
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
background-color: ${props => props.theme.error};
|
background-color: ${props => props.theme.error};
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
|
|
@ -10,6 +9,19 @@ export const Wrapper = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
font-size: 18px;
|
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`
|
export const CloseButton = styled.button`
|
||||||
|
|
|
||||||
|
|
@ -229,9 +229,7 @@ const Create = ({ offline }) => {
|
||||||
defaultOption={t('home:form.timezone.defaultOption')}
|
defaultOption={t('home:form.timezone.defaultOption')}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{error && (
|
<Error open={!!error} onClose={() => setError(null)}>{error}</Error>
|
||||||
<Error onClose={() => setError(null)}>{error}</Error>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Button type="submit" isLoading={isLoading} disabled={isLoading} buttonWidth="100%">{t('home:form.button')}</Button>
|
<Button type="submit" isLoading={isLoading} disabled={isLoading} buttonWidth="100%">{t('home:form.button')}</Button>
|
||||||
</CreateForm>
|
</CreateForm>
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,7 @@ const Event = (props) => {
|
||||||
buttonWidth={`${Math.max(t('event:form.button').length*11, 100)}px`}
|
buttonWidth={`${Math.max(t('event:form.button').length*11, 100)}px`}
|
||||||
>{t('event:form.button')}</Button>
|
>{t('event:form.button')}</Button>
|
||||||
</LoginForm>
|
</LoginForm>
|
||||||
{error && <Error onClose={() => setError(null)}>{error}</Error>}
|
<Error open={!!error} onClose={() => setError(null)}>{error}</Error>
|
||||||
<Info>{t('event:form.info')}</Info>
|
<Info>{t('event:form.info')}</Info>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -206,9 +206,7 @@ const Home = ({ offline }) => {
|
||||||
defaultOption={t('home:form.timezone.defaultOption')}
|
defaultOption={t('home:form.timezone.defaultOption')}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{error && (
|
<Error open={!!error} onClose={() => setError(null)}>{error}</Error>
|
||||||
<Error onClose={() => setError(null)}>{error}</Error>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Center>
|
<Center>
|
||||||
<Button type="submit" isLoading={isLoading} disabled={isLoading}>{t('home:form.button')}</Button>
|
<Button type="submit" isLoading={isLoading} disabled={isLoading}>{t('home:form.button')}</Button>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue