import React from 'react'; import PageContentBlock from '@/components/elements/PageContentBlock'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faArrowLeft } from '@fortawesome/free-solid-svg-icons/faArrowLeft'; import { faSyncAlt } from '@fortawesome/free-solid-svg-icons/faSyncAlt'; import classNames from 'classnames'; import styled from 'styled-components'; interface BaseProps { title?: string; message: string; onRetry?: () => void; onBack?: () => void; } interface PropsWithRetry extends BaseProps { onRetry?: () => void; onBack?: never | undefined; } interface PropsWithBack extends BaseProps { onBack?: () => void; onRetry?: never | undefined; } type Props = PropsWithBack | PropsWithRetry; const ActionButton = styled.button` ${tw`rounded-full w-8 h-8 flex items-center justify-center`}; &.hover\\:spin:hover { animation: spin 2s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } } `; export default ({ title, message, onBack, onRetry }: Props) => (
{(typeof onBack === 'function' || typeof onRetry === 'function') &&
onRetry ? onRetry() : (onBack ? onBack() : null)} className={classNames('btn btn-primary', { 'hover:spin': !!onRetry })} >
}

{title || 'Something went wrong!'}

{message}

);