Fix authentication page on mobile devices

This commit is contained in:
Dane Everitt 2019-12-22 21:18:29 -08:00
parent 513692fef5
commit 1f6f7c4bb4
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
10 changed files with 94 additions and 80 deletions

View file

@ -1,19 +1,32 @@
import React from 'react'; import React from 'react';
import { Route } from 'react-router'; import { Route } from 'react-router';
import { CSSTransition, TransitionGroup } from 'react-transition-group'; import { CSSTransition, TransitionGroup } from 'react-transition-group';
import styled from 'styled-components';
import { breakpoint } from 'styled-components-breakpoint';
type Props = Readonly<{ type Props = Readonly<{
children: React.ReactNode; children: React.ReactNode;
}>; }>;
const ContentContainer = styled.div`
max-width: 1200px;
${tw`mx-4`};
${breakpoint('xl')`
${tw`mx-auto`};
`};
`;
export default ({ children }: Props) => ( export default ({ children }: Props) => (
<Route <Route
render={({ location }) => ( render={({ location }) => (
<TransitionGroup className={'route-transition-group'}> <TransitionGroup className={'route-transition-group'}>
<CSSTransition key={location.key} timeout={250} in={true} appear={true} classNames={'fade'}> <CSSTransition key={location.key} timeout={250} in={true} appear={true} classNames={'fade'}>
<section> <section>
<ContentContainer>
{children} {children}
<div className={'mx-auto w-full'} style={{ maxWidth: '1200px' }}> </ContentContainer>
<ContentContainer className={'mb-4'}>
<p className={'text-right text-neutral-500 text-xs'}> <p className={'text-right text-neutral-500 text-xs'}>
&copy; 2015 - 2019&nbsp; &copy; 2015 - 2019&nbsp;
<a <a
@ -25,7 +38,7 @@ export default ({ children }: Props) => (
Pterodactyl Software Pterodactyl Software
</a> </a>
</p> </p>
</div> </ContentContainer>
</section> </section>
</CSSTransition> </CSSTransition>
</TransitionGroup> </TransitionGroup>

View file

@ -32,8 +32,6 @@ const LoginContainer = ({ isSubmitting, setFieldValue, values, submitForm, handl
handleSubmit(e); handleSubmit(e);
}; };
console.log(values.recaptchaData);
return ( return (
<React.Fragment> <React.Fragment>
{ref.current && ref.current.render()} {ref.current && ref.current.render()}

View file

@ -1,21 +1,40 @@
import React, { forwardRef } from 'react'; import React, { forwardRef } from 'react';
import styled from 'styled-components';
import { Form } from 'formik';
import { breakpoint } from 'styled-components-breakpoint';
type Props = React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>; type Props = React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, 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<any, Props>(({ className, ...props }, ref) => ( export default forwardRef<any, Props>(({ className, ...props }, ref) => (
<form <Form {...props}>
ref={ref} <LoginContainer>
className={'flex items-center justify-center login-box'} <div className={'flex-none select-none mb-6 md:mb-0 self-center'}>
{...props} <img src={'/assets/pterodactyl.svg'} className={'block w-48 md:w-64 mx-auto'}/>
style={{
paddingLeft: 0,
}}
>
<div className={'flex-none select-none'}>
<img src={'/assets/pterodactyl.svg'} className={'w-64'}/>
</div> </div>
<div className={'flex-1'}> <div className={'flex-1'}>
{props.children} {props.children}
</div> </div>
</form> </LoginContainer>
</Form>
)); ));

View file

@ -6,7 +6,7 @@ import ResetPasswordContainer from '@/components/auth/ResetPasswordContainer';
import LoginCheckpointContainer from '@/components/auth/LoginCheckpointContainer'; import LoginCheckpointContainer from '@/components/auth/LoginCheckpointContainer';
export default ({ match }: RouteComponentProps) => ( export default ({ match }: RouteComponentProps) => (
<div className={'mt-32'}> <div className={'mt-8 xl:mt-32'}>
<Route path={`${match.path}/login`} component={LoginContainer} exact/> <Route path={`${match.path}/login`} component={LoginContainer} exact/>
<Route path={`${match.path}/login/checkpoint`} component={LoginCheckpointContainer}/> <Route path={`${match.path}/login/checkpoint`} component={LoginCheckpointContainer}/>
<Route path={`${match.path}/password`} component={ForgotPasswordContainer} exact/> <Route path={`${match.path}/password`} component={ForgotPasswordContainer} exact/>

View file

@ -10,13 +10,11 @@ export default ({ location }: RouteComponentProps) => (
<React.Fragment> <React.Fragment>
<NavigationBar/> <NavigationBar/>
<TransitionRouter> <TransitionRouter>
<div className={'w-full mx-auto'} style={{ maxWidth: '1200px' }}>
<Switch location={location}> <Switch location={location}>
<Route path={'/'} component={DashboardContainer} exact/> <Route path={'/'} component={DashboardContainer} exact/>
<Route path={'/account'} component={AccountOverviewContainer}/> <Route path={'/account'} component={AccountOverviewContainer}/>
<Route path={'/design'} component={DesignElementsContainer}/> <Route path={'/design'} component={DesignElementsContainer}/>
</Switch> </Switch>
</div>
</TransitionRouter> </TransitionRouter>
</React.Fragment> </React.Fragment>
); );

View file

@ -1,4 +1,4 @@
import React, { lazy, useEffect } from 'react'; import React, { useEffect } from 'react';
import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom'; import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom';
import NavigationBar from '@/components/NavigationBar'; import NavigationBar from '@/components/NavigationBar';
import ServerConsole from '@/components/server/ServerConsole'; import ServerConsole from '@/components/server/ServerConsole';
@ -12,8 +12,6 @@ import FileManagerContainer from '@/components/server/files/FileManagerContainer
import { CSSTransition } from 'react-transition-group'; import { CSSTransition } from 'react-transition-group';
import SuspenseSpinner from '@/components/elements/SuspenseSpinner'; import SuspenseSpinner from '@/components/elements/SuspenseSpinner';
import FileEditContainer from '@/components/server/files/FileEditContainer'; import FileEditContainer from '@/components/server/files/FileEditContainer';
import UsersContainer from '@/components/server/users/UsersContainer';
import ScheduleContainer from '@/components/server/schedules/ScheduleContainer';
import SettingsContainer from '@/components/server/settings/SettingsContainer'; import SettingsContainer from '@/components/server/settings/SettingsContainer';
const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) => { const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) => {
@ -32,7 +30,6 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
<NavigationBar/> <NavigationBar/>
<CSSTransition timeout={250} classNames={'fade'} appear={true} in={true}> <CSSTransition timeout={250} classNames={'fade'} appear={true} in={true}>
<div id={'sub-navigation'}> <div id={'sub-navigation'}>
<div className={'mx-auto'} style={{ maxWidth: '1200px' }}>
<div className={'items'}> <div className={'items'}>
<NavLink to={`${match.url}`} exact>Console</NavLink> <NavLink to={`${match.url}`} exact>Console</NavLink>
<NavLink to={`${match.url}/files`}>File Manager</NavLink> <NavLink to={`${match.url}/files`}>File Manager</NavLink>
@ -42,12 +39,10 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
<NavLink to={`${match.url}/settings`}>Settings</NavLink> <NavLink to={`${match.url}/settings`}>Settings</NavLink>
</div> </div>
</div> </div>
</div>
</CSSTransition> </CSSTransition>
<Provider store={ServerContext.useStore()}> <Provider store={ServerContext.useStore()}>
<WebsocketHandler/> <WebsocketHandler/>
<TransitionRouter> <TransitionRouter>
<div className={'w-full mx-auto px-3'} style={{ maxWidth: '1200px' }}>
{!server ? {!server ?
<div className={'flex justify-center m-20'}> <div className={'flex justify-center m-20'}>
<Spinner size={'large'}/> <Spinner size={'large'}/>
@ -73,7 +68,6 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
</Switch> </Switch>
</React.Fragment> </React.Fragment>
} }
</div>
</TransitionRouter> </TransitionRouter>
</Provider> </Provider>
</React.Fragment> </React.Fragment>

View file

@ -1,9 +0,0 @@
.login-box {
@apply .bg-white .shadow-lg .rounded-lg .p-6;
@screen xsx {
@apply .rounded-none;
margin-top: 25%;
box-shadow: 0 15px 30px 0 rgba(0, 0, 0, .2), 0 -15px 30px 0 rgba(0, 0, 0, .2);
}
}

View file

@ -1,3 +1,7 @@
form {
@apply .m-0;
}
textarea, select, input, button { textarea, select, input, button {
@apply .outline-none; @apply .outline-none;
} }

View file

@ -11,7 +11,6 @@
*/ */
@import "components/typography.css"; @import "components/typography.css";
@import "components/animations.css"; @import "components/animations.css";
@import "components/authentication.css";
@import "components/forms.css"; @import "components/forms.css";
@import "components/miscellaneous.css"; @import "components/miscellaneous.css";
@import "components/modal.css"; @import "components/modal.css";

View file

@ -3,7 +3,5 @@
]) ])
@section('container') @section('container')
<div class="w-full max-w-xs sm:max-w-md m-auto mt-8">
<div id="app"></div> <div id="app"></div>
</div>
@endsection @endsection