feat: rework login page

This commit is contained in:
Sonny
2023-12-16 20:46:54 +01:00
parent f3e0b8afae
commit f44d1c2d33
17 changed files with 113 additions and 75 deletions

View File

@@ -41,5 +41,8 @@
"profile": "Profile",
"select-your-lang": "Change the language",
"name": "Name",
"email": "Email"
"email": "Email",
"footer": {
"made_by": "Made with ❤\uFE0F by"
}
}

View File

@@ -1,8 +1,5 @@
{
"select-category": "Please select a category",
"or-create-one": "or create one",
"no-link": "No link for <b>{{name}}</b>",
"footer": {
"made_by": "Made with ❤\uFE0F by"
}
"no-link": "No link for <b>{{name}}</b>"
}

View File

@@ -1,5 +1,6 @@
{
"title": "Authentication",
"informative-text": "Authentication required to use MyLinks",
"continue-with": "Continue with {{provider}}"
"continue-with": "Continue with {{provider}}",
"slogan": "Manage your links in the best possible way"
}

View File

@@ -41,5 +41,8 @@
"profile": "Profil",
"select-your-lang": "Modifier la langue",
"name": "Nom",
"email": "Email"
"email": "Email",
"footer": {
"made_by": "Fait avec ❤\uFE0F par"
}
}

View File

@@ -1,8 +1,5 @@
{
"select-category": "Veuillez sélectionner une categories",
"or-create-one": "ou en créer une",
"no-link": "Aucun lien pour <b>{{name}}</b>",
"footer": {
"made_by": "Fait avec ❤\uFE0F par"
}
"no-link": "Aucun lien pour <b>{{name}}</b>"
}

View File

@@ -1,5 +1,6 @@
{
"title": "Authentification",
"informative-text": "Authentification requise pour utiliser ce service",
"continue-with": "Continuer avec {{provider}}"
"informative-text": "Authentification requise pour utiliser MyLinks",
"continue-with": "Continuer avec {{provider}}",
"slogan": "Gérez vos liens de la meilleure des façons"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

View File

@@ -1,10 +1,10 @@
import PATHS from 'constants/paths';
import LinkTag from 'next/link';
import { useTranslation } from 'next-i18next';
import styles from './links.module.scss';
import LinkTag from 'next/link';
import styles from './footer.module.scss';
export default function LinksFooter() {
const { t } = useTranslation('home');
export default function Footer() {
const { t } = useTranslation('common');
return (
<footer className={styles['footer']}>
@@ -14,7 +14,7 @@ export default function LinksFooter() {
<LinkTag href={PATHS.TERMS}>{t('common:terms')}</LinkTag>
</div>
<div className='bottom'>
{t('home:footer.made_by')}{' '}
{t('common:footer.made_by')}{' '}
<LinkTag
href={PATHS.AUTHOR}
target='_blank'

View File

@@ -0,0 +1,8 @@
@import 'styles/colors.scss';
.footer {
font-size: 0.9em;
color: $grey;
text-align: center;
padding: 0.75em 0 0.25em;
}

View File

@@ -1,4 +1,5 @@
import clsx from 'clsx';
import Footer from 'components/Footer/Footer';
import MobileCategoriesModal from 'components/MobileCategoriesModal';
import CreateItem from 'components/QuickActions/CreateItem';
import EditItem from 'components/QuickActions/EditItem';
@@ -11,7 +12,6 @@ import LinkTag from 'next/link';
import { BiSearchAlt } from 'react-icons/bi';
import quickActionStyles from '../QuickActions/quickactions.module.scss';
import LinkItem from './LinkItem';
import LinksFooter from './LinksFooter';
import styles from './links.module.scss';
interface LinksProps {
@@ -93,7 +93,7 @@ export default function Links({ isMobile }: Readonly<LinksProps>) {
</LinkTag>
</div>
)}
<LinksFooter />
<Footer />
</div>
);
}

View File

@@ -188,10 +188,3 @@
animation: rotate 1s both reverse infinite linear;
}
}
.footer {
font-size: 0.8em;
color: $grey;
text-align: center;
padding: 0.75em 0 0.25em;
}

View File

@@ -16,6 +16,7 @@
.modal-container {
background: $light-grey;
min-height: 250px;
min-width: 500px;
margin-top: 6em;
border-radius: 3px;

View File

@@ -1,4 +1,5 @@
import ButtonLink from 'components/ButtonLink';
import clsx from 'clsx';
import Footer from 'components/Footer/Footer';
import LangSelector from 'components/LangSelector';
import MessageManager from 'components/MessageManager/MessageManager';
import PageTransition from 'components/PageTransition';
@@ -28,28 +29,28 @@ export default function SignIn({ providers }: Readonly<SignInProps>) {
hideLangageSelector
>
<NextSeo title={t('login:title')} />
<div className={styles['image-wrapper']}>
<Image
src={'/logo-light.png'}
width={300}
height={100}
alt="MyLinks's logo"
/>
</div>
<Image
src={'/logo-light.png'}
width={300}
height={100}
alt="MyLinks's logo"
/>
<p className={styles['slogan']}>{t('login:slogan')}</p>
<div className={styles['form-wrapper']}>
<h1>{t('login:title')}</h1>
<MessageManager info={t('login:informative-text')} />
{Object.values(providers).map(({ name, id }) => (
<ButtonLink
onClick={() => signIn(id, { callbackUrl: PATHS.HOME })}
className={styles['login-button']}
<button
onClick={() => signIn(id)}
className={clsx(styles['login-button'], 'btn')}
key={id}
>
<FcGoogle size={'1.5em'} />{' '}
<FcGoogle size='1.5em' />{' '}
{t('login:continue-with', { provider: name })}
</ButtonLink>
</button>
))}
</div>
<Footer />
</PageTransition>
<div className='lang-selector'>
<LangSelector />
@@ -69,7 +70,7 @@ export async function getServerSideProps({ req, res, locale }) {
};
}
const providers = await getProviders();
const providers = (await getProviders()) ?? [];
return {
props: {
session,

View File

@@ -82,14 +82,15 @@ h6 {
}
}
button:not(.reset) {
button:not(.reset),
a.btn:not(.reset) {
cursor: pointer;
width: 100%;
text-transform: uppercase;
font-size: 14px;
color: $white;
background: $blue;
padding: 10px;
padding: 0.75em;
border: 1px solid $blue;
border-radius: 3px;
transition: 0.15s;

View File

@@ -2,38 +2,55 @@
@import 'colors.scss';
.login-page {
position: relative;
height: 100%;
width: 100%;
background-size: cover;
background: url('/login-bg-final.webp') bottom;
width: 500px;
margin-top: 50px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.login-container {
width: auto;
width: 100%;
max-width: 100%;
white-space: nowrap;
background-color: $black-blur;
backdrop-filter: blur(0.35em);
padding: 2.5em;
border-radius: 5px;
border: 1px solid $white;
display: flex;
gap: 2.5em;
flex-direction: row;
align-items: center;
gap: 1.5em;
flex-direction: column;
}
.image-wrapper {
display: flex;
flex: 1;
align-items: center;
justify-items: center;
.slogan {
position: relative;
width: fit-content;
white-space: pre-wrap;
text-align: center;
font-style: italic;
color: rgba($color: $black, $alpha: 0.75);
&::before {
position: absolute;
left: -0.65em;
content: '';
font-family: sans-serif;
font-size: 2.25em;
}
&::after {
position: absolute;
right: -0.5em;
content: '';
font-family: sans-serif;
font-size: 2.25em;
}
}
.form-wrapper {
width: 100%;
background-color: $white;
padding: 2em;
border-radius: 3px;
border: 1px solid $lightest-grey;
display: flex;
gap: 1em;
flex: 1;
@@ -42,31 +59,38 @@
flex-direction: column;
& h1 {
color: $white;
color: $black;
}
& p {
font-size: 0.9em;
font-style: italic;
white-space: pre-wrap;
color: $grey;
display: flex;
gap: 0.25em;
}
}
.login-button {
width: 100%;
color: $dark-blue;
background-color: $white;
padding: 0.5em;
border-radius: 3px;
display: flex;
gap: 0.25em;
gap: 0.5em;
align-items: center;
justify-content: center;
& > svg {
background-color: $white;
padding: 3px;
border-radius: 50%;
}
}
@media (max-width: calc(768px + 4em)) {
.login-page {
padding: 1em;
justify-content: flex-start;
}
.login-container {
width: auto;
width: 100%;
white-space: break-spaces;
padding: 1em;
align-items: center;
flex-direction: column;
}

View File

@@ -1,5 +1,13 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
const globalForPrisma = global as unknown as { prisma: PrismaClient };
const prisma =
globalForPrisma.prisma ||
new PrismaClient({
log: ['error', 'info', 'warn'],
});
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
export default prisma;