diff --git a/src/components/big-card.tsx b/src/components/big-card.tsx new file mode 100644 index 000000000..2fcb7078a --- /dev/null +++ b/src/components/big-card.tsx @@ -0,0 +1,32 @@ +import React from 'react'; + +import { Card, CardBody, Stack, Text } from 'soapbox/components/ui'; + +interface IBigCard { + title: React.ReactNode + subtitle?: React.ReactNode + children: React.ReactNode +} + +const BigCard: React.FC = ({ title, subtitle, children }) => { + return ( + + +
+ + {title} + {subtitle && {subtitle}} + +
+ + +
+ {children} +
+
+
+
+ ); +}; + +export { BigCard }; \ No newline at end of file diff --git a/src/containers/soapbox.tsx b/src/containers/soapbox.tsx index deebda4ee..fb5a15971 100644 --- a/src/containers/soapbox.tsx +++ b/src/containers/soapbox.tsx @@ -17,7 +17,6 @@ import GdprBanner from 'soapbox/components/gdpr-banner'; import Helmet from 'soapbox/components/helmet'; import LoadingScreen from 'soapbox/components/loading-screen'; import { StatProvider } from 'soapbox/contexts/stat-context'; -import AuthLayout from 'soapbox/features/auth-layout'; import EmbeddedStatus from 'soapbox/features/embedded-status'; import PublicLayout from 'soapbox/features/public-layout'; import BundleContainer from 'soapbox/features/ui/containers/bundle-container'; @@ -104,11 +103,6 @@ const SoapboxMount = () => { )} - - - - - ); diff --git a/src/features/auth-layout/index.tsx b/src/features/auth-layout/index.tsx deleted file mode 100644 index df1d0dd4b..000000000 --- a/src/features/auth-layout/index.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import React from 'react'; -import { defineMessages, useIntl } from 'react-intl'; -import { Link, Redirect, Route, Switch, useHistory, useLocation } from 'react-router-dom'; - -import LandingGradient from 'soapbox/components/landing-gradient'; -import SiteLogo from 'soapbox/components/site-logo'; -import { useOwnAccount, useInstance, useRegistrationStatus } from 'soapbox/hooks'; - -import { Button, Card, CardBody } from '../../components/ui'; -import LoginPage from '../auth-login/components/login-page'; -import PasswordReset from '../auth-login/components/password-reset'; -import PasswordResetConfirm from '../auth-login/components/password-reset-confirm'; -import ExternalLoginForm from '../external-login/components/external-login-form'; -import Footer from '../public-layout/components/footer'; -import RegisterInvite from '../register-invite'; - -const messages = defineMessages({ - register: { id: 'auth_layout.register', defaultMessage: 'Create an account' }, -}); - -const AuthLayout = () => { - const intl = useIntl(); - const history = useHistory(); - const { search } = useLocation(); - - const { account } = useOwnAccount(); - const instance = useInstance(); - const { isOpen } = useRegistrationStatus(); - const isLoginPage = history.location.pathname === '/login'; - - return ( -
- - -
-
-
-
- - - -
- - {(isLoginPage && isOpen) && ( -
- -
- )} -
- -
-
- - - - {/* If already logged in, redirect home. */} - {account && } - - - - - - - - - - - - - -
-
- -
-
-
-
-
-
- ); -}; - -export default AuthLayout; diff --git a/src/features/auth-login/components/login-form.tsx b/src/features/auth-login/components/login-form.tsx index d7871fc75..19f9e76bb 100644 --- a/src/features/auth-login/components/login-form.tsx +++ b/src/features/auth-login/components/login-form.tsx @@ -2,11 +2,9 @@ import React from 'react'; import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import { Link } from 'react-router-dom'; -import { Button, Form, FormActions, FormGroup, Input, Stack } from 'soapbox/components/ui'; +import { Button, Form, FormActions, FormGroup, Input } from 'soapbox/components/ui'; import { useFeatures } from 'soapbox/hooks'; -import ConsumersList from './consumers-list'; - const messages = defineMessages({ username: { id: 'login.fields.username_label', @@ -35,62 +33,52 @@ const LoginForm: React.FC = ({ isLoading, handleSubmit }) => { const passwordLabel = intl.formatMessage(messages.password); return ( -
-
-

-
+
+ + + - - - - + - + + } + > + + - - - - } - > - - - - - - - - - -
-
+ + + + ); }; diff --git a/src/features/auth-login/components/login-page.tsx b/src/features/auth-login/components/login-page.tsx index 609af73a4..8817b6d39 100644 --- a/src/features/auth-login/components/login-page.tsx +++ b/src/features/auth-login/components/login-page.tsx @@ -1,13 +1,16 @@ import React, { useState } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Redirect } from 'react-router-dom'; import { logIn, verifyCredentials, switchAccount } from 'soapbox/actions/auth'; import { fetchInstance } from 'soapbox/actions/instance'; import { closeModal } from 'soapbox/actions/modals'; +import { BigCard } from 'soapbox/components/big-card'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import { getRedirectUrl } from 'soapbox/utils/redirect'; import { isStandalone } from 'soapbox/utils/state'; +import ConsumersList from './consumers-list'; import LoginForm from './login-form'; import OtpAuthForm from './otp-auth-form'; @@ -68,7 +71,12 @@ const LoginPage = () => { if (mfaAuthNeeded) return ; - return ; + return ( + }> + + + + ); }; export default LoginPage; diff --git a/src/features/auth-login/components/otp-auth-form.tsx b/src/features/auth-login/components/otp-auth-form.tsx index 06423e5e6..a7b55d21d 100644 --- a/src/features/auth-login/components/otp-auth-form.tsx +++ b/src/features/auth-login/components/otp-auth-form.tsx @@ -3,6 +3,7 @@ import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import { Redirect } from 'react-router-dom'; import { otpVerify, verifyCredentials, switchAccount } from 'soapbox/actions/auth'; +import { BigCard } from 'soapbox/components/big-card'; import { Button, Form, FormActions, FormGroup, Input } from 'soapbox/components/ui'; import { useAppDispatch } from 'soapbox/hooks'; @@ -47,41 +48,33 @@ const OtpAuthForm: React.FC = ({ mfa_token }) => { if (shouldRedirect) return ; return ( -
-
-

- -

-
+ }> +
+ + + -
- - + - - -
-
+ + + + + ); }; diff --git a/src/features/auth-login/components/password-reset-confirm.tsx b/src/features/auth-login/components/password-reset-confirm.tsx index 78ef26fd7..c079b418d 100644 --- a/src/features/auth-login/components/password-reset-confirm.tsx +++ b/src/features/auth-login/components/password-reset-confirm.tsx @@ -3,6 +3,7 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { Redirect } from 'react-router-dom'; import { resetPasswordConfirm } from 'soapbox/actions/security'; +import { BigCard } from 'soapbox/components/big-card'; import { Button, Form, FormActions, FormGroup, Input } from 'soapbox/components/ui'; import { useAppDispatch } from 'soapbox/hooks'; @@ -55,33 +56,25 @@ const PasswordResetConfirm = () => { } return ( -
-
-

- -

-
+ }> +
+ } errors={renderErrors()}> + + -
- - } errors={renderErrors()}> - - - - - - - -
-
+ + + + + ); }; diff --git a/src/features/auth-login/components/password-reset.tsx b/src/features/auth-login/components/password-reset.tsx index 6cc9109d3..11d1f42f0 100644 --- a/src/features/auth-login/components/password-reset.tsx +++ b/src/features/auth-login/components/password-reset.tsx @@ -3,6 +3,7 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { Redirect } from 'react-router-dom'; import { resetPassword } from 'soapbox/actions/security'; +import { BigCard } from 'soapbox/components/big-card'; import { Button, Form, FormActions, FormGroup, Input } from 'soapbox/components/ui'; import { useAppDispatch, useFeatures } from 'soapbox/hooks'; import toast from 'soapbox/toast'; @@ -36,32 +37,24 @@ const PasswordReset = () => { if (success) return ; return ( -
-
-

- -

-
+ }> +
+ + + -
- - - - - - - - - -
-
+ + + + + ); }; diff --git a/src/features/auth-login/components/registration-page.tsx b/src/features/auth-login/components/registration-page.tsx index c58633fa6..7f1e81ce5 100644 --- a/src/features/auth-login/components/registration-page.tsx +++ b/src/features/auth-login/components/registration-page.tsx @@ -1,18 +1,15 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Card, CardTitle, Stack } from 'soapbox/components/ui'; +import { BigCard } from 'soapbox/components/big-card'; import RegistrationForm from './registration-form'; const RegistrationPage: React.FC = () => { return ( - - - } /> - - - + }> + + ); }; diff --git a/src/features/external-login/index.tsx b/src/features/external-login/index.tsx index 510014dc2..507797f9a 100644 --- a/src/features/external-login/index.tsx +++ b/src/features/external-login/index.tsx @@ -1,10 +1,17 @@ import React from 'react'; +import { FormattedMessage } from 'react-intl'; + +import { BigCard } from 'soapbox/components/big-card'; import ExternalLoginForm from './components/external-login-form'; /** Page for logging into a remote instance */ const ExternalLoginPage: React.FC = () => { - return ; + return ( + }> + + + ); }; export default ExternalLoginPage; diff --git a/src/features/onboarding/steps/avatar-selection-step.tsx b/src/features/onboarding/steps/avatar-selection-step.tsx index 55a54c514..149d5e3e3 100644 --- a/src/features/onboarding/steps/avatar-selection-step.tsx +++ b/src/features/onboarding/steps/avatar-selection-step.tsx @@ -3,7 +3,8 @@ import React from 'react'; import { defineMessages, FormattedMessage } from 'react-intl'; import { patchMe } from 'soapbox/actions/me'; -import { Avatar, Button, Card, CardBody, Icon, Spinner, Stack, Text } from 'soapbox/components/ui'; +import { BigCard } from 'soapbox/components/big-card'; +import { Avatar, Button, Icon, Spinner, Stack } from 'soapbox/components/ui'; import { useAppDispatch, useOwnAccount } from 'soapbox/hooks'; import toast from 'soapbox/toast'; import { isDefaultAvatar } from 'soapbox/utils/accounts'; @@ -64,69 +65,54 @@ const AvatarSelectionStep = ({ onNext }: { onNext: () => void }) => { }; return ( - - -
-
- - - - + } + subtitle={} + > + +
+ {account && ( + + )} - - - - -
+ {isSubmitting && ( +
+ +
+ )} -
- -
- {account && ( - - )} + - {isSubmitting && ( -
- -
- )} - - - - -
- - - - - {isDisabled && ( - - )} - -
-
+
- - + + + + + {isDisabled && ( + + )} + + + ); }; diff --git a/src/features/onboarding/steps/bio-step.tsx b/src/features/onboarding/steps/bio-step.tsx index c0a029d80..6b2862bbb 100644 --- a/src/features/onboarding/steps/bio-step.tsx +++ b/src/features/onboarding/steps/bio-step.tsx @@ -2,7 +2,8 @@ import React from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { patchMe } from 'soapbox/actions/me'; -import { Button, Card, CardBody, FormGroup, Stack, Text, Textarea } from 'soapbox/components/ui'; +import { BigCard } from 'soapbox/components/big-card'; +import { Button, FormGroup, Stack, Textarea } from 'soapbox/components/ui'; import { useAppDispatch, useOwnAccount } from 'soapbox/hooks'; import toast from 'soapbox/toast'; @@ -43,62 +44,49 @@ const BioStep = ({ onNext }: { onNext: () => void }) => { }; return ( - - + } + subtitle={} + > +
-
- - - - + } + labelText={} + errors={errors} + > +