From f9ec96c70ad17ff2fc691559a49a91c285203d21 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 19 Jan 2020 14:31:07 -0800 Subject: [PATCH] Fix login error message width, closes #1792 --- .../components/auth/LoginContainer.tsx | 124 +++++++++++------- .../components/auth/LoginFormContainer.tsx | 29 +--- 2 files changed, 78 insertions(+), 75 deletions(-) diff --git a/resources/scripts/components/auth/LoginContainer.tsx b/resources/scripts/components/auth/LoginContainer.tsx index fae4fa40d..23c75b7cb 100644 --- a/resources/scripts/components/auth/LoginContainer.tsx +++ b/resources/scripts/components/auth/LoginContainer.tsx @@ -12,12 +12,33 @@ import { httpErrorToHuman } from '@/api/http'; import { FlashMessage } from '@/state/flashes'; import ReCAPTCHA from 'react-google-recaptcha'; import Spinner from '@/components/elements/Spinner'; +import styled from 'styled-components'; +import { breakpoint } from 'styled-components-breakpoint'; type OwnProps = RouteComponentProps & { clearFlashes: ActionCreator; addFlash: ActionCreator; } +const Container = styled.div` + ${breakpoint('sm')` + ${tw`w-4/5 mx-auto`} + `}; + + ${breakpoint('md')` + ${tw`p-10`} + `}; + + ${breakpoint('lg')` + ${tw`w-3/5`} + `}; + + ${breakpoint('xl')` + ${tw`w-full`} + max-width: 660px; + `}; +`; + const LoginContainer = ({ isSubmitting, setFieldValue, values, submitForm, handleSubmit }: OwnProps & FormikProps) => { const ref = useRef(null); const { enabled: recaptchaEnabled, siteKey } = useStoreState(state => state.settings.data!.recaptcha); @@ -38,58 +59,63 @@ const LoginContainer = ({ isSubmitting, setFieldValue, values, submitForm, handl

Login to Continue

- - - - -
- + + + + -
-
- -
- {recaptchaEnabled && - { - ref.current && ref.current.reset(); - setFieldValue('recaptchaData', token); - submitForm(); - }} - onExpired={() => setFieldValue('recaptchaData', null)} - /> - } -
- - Forgot password? - -
-
+
+ + +
+
+ +
+ {recaptchaEnabled && + { + ref.current && ref.current.reset(); + setFieldValue('recaptchaData', token); + submitForm(); + }} + onExpired={() => setFieldValue('recaptchaData', null)} + /> + } +
+ + Forgot password? + +
+ + ); }; diff --git a/resources/scripts/components/auth/LoginFormContainer.tsx b/resources/scripts/components/auth/LoginFormContainer.tsx index 68ff4a3a9..bfdbe6782 100644 --- a/resources/scripts/components/auth/LoginFormContainer.tsx +++ b/resources/scripts/components/auth/LoginFormContainer.tsx @@ -1,40 +1,17 @@ import React, { forwardRef } from 'react'; -import styled from 'styled-components'; import { Form } from 'formik'; -import { breakpoint } from 'styled-components-breakpoint'; type Props = React.DetailedHTMLProps, HTMLFormElement>; -const LoginContainer = styled.div` - ${tw`bg-white shadow-lg rounded-lg p-6 mx-1`}; - - ${breakpoint('sm')` - ${tw`w-4/5 mx-auto`} - `}; - - ${breakpoint('md')` - ${tw`flex p-10`} - `}; - - ${breakpoint('lg')` - ${tw`w-3/5`} - `}; - - ${breakpoint('xl')` - ${tw`w-full`} - max-width: 660px; - `}; -`; - -export default forwardRef(({ className, ...props }, ref) => ( +export default forwardRef(({ ...props }, ref) => (
- +
{props.children}
- +
));