misc_pterodactyl-panel/resources/scripts/components/auth/LoginFormContainer.tsx

62 lines
1.8 KiB
TypeScript
Raw Normal View History

2019-12-16 02:05:44 +00:00
import React, { forwardRef } from 'react';
import { Form } from 'formik';
2020-07-03 21:19:05 +00:00
import styled from 'styled-components/macro';
2020-07-04 21:21:28 +00:00
import { breakpoint } from '@/theme';
import FlashMessageRender from '@/components/FlashMessageRender';
2020-07-03 21:19:05 +00:00
import tw from 'twin.macro';
2019-06-22 20:53:41 +00:00
type Props = React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement> & {
title?: string;
}
2019-12-16 02:05:44 +00:00
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: 700px;
`};
`;
export default forwardRef<HTMLFormElement, Props>(({ title, ...props }, ref) => (
<Container>
2020-07-04 21:21:28 +00:00
{title &&
<h2 css={tw`text-3xl text-center text-neutral-100 font-medium py-4`}>
{title}
2020-07-04 21:21:28 +00:00
</h2>
}
<FlashMessageRender css={tw`mb-2 px-1`}/>
<Form {...props} ref={ref}>
2020-07-04 21:21:28 +00:00
<div css={tw`md:flex w-full bg-white shadow-lg rounded-lg p-6 md:pl-0 mx-1`}>
<div css={tw`flex-none select-none mb-6 md:mb-0 self-center`}>
<img src={'/assets/svgs/pterodactyl.svg'} css={tw`block w-48 md:w-64 mx-auto`}/>
</div>
2020-07-04 21:21:28 +00:00
<div css={tw`flex-1`}>
{props.children}
</div>
</div>
</Form>
2020-07-04 21:21:28 +00:00
<p css={tw`text-center text-neutral-500 text-xs mt-4`}>
2020-04-17 21:43:03 +00:00
&copy; 2015 - 2020&nbsp;
<a
2020-07-04 21:21:28 +00:00
rel={'noopener nofollow noreferrer'}
2020-04-17 21:43:03 +00:00
href={'https://pterodactyl.io'}
target={'_blank'}
2020-07-04 21:21:28 +00:00
css={tw`no-underline text-neutral-500 hover:text-neutral-300`}
2020-04-17 21:43:03 +00:00
>
Pterodactyl Software
</a>
</p>
</Container>
2019-12-16 02:05:44 +00:00
));