mirror of
https://github.com/fergalmoran/supanextail.git
synced 2025-12-22 09:17:54 +00:00
Continue typescript conversion
This commit is contained in:
@@ -20,7 +20,7 @@ const CardsLanding = () => (
|
|||||||
<CardLanding
|
<CardLanding
|
||||||
image={cardPage}
|
image={cardPage}
|
||||||
text="7 pages fully designed and easily customizable"
|
text="7 pages fully designed and easily customizable"
|
||||||
title="Templates"
|
title='"Templates"'
|
||||||
/>
|
/>
|
||||||
<CardLanding
|
<CardLanding
|
||||||
image={cardServer}
|
image={cardServer}
|
||||||
|
|||||||
@@ -8,11 +8,16 @@ import Image from 'next/image';
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import Logo from 'public/logo.svg';
|
import Logo from 'public/logo.svg';
|
||||||
|
|
||||||
const Nav = (props: any) => {
|
type NavProps = {
|
||||||
|
user: Record<string, unknown>;
|
||||||
|
signOut: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const Nav = ({ user, signOut }: NavProps): JSX.Element => {
|
||||||
// Modify you menu directly here
|
// Modify you menu directly here
|
||||||
const NavMenu = (
|
const NavMenu = (
|
||||||
<>
|
<>
|
||||||
{props.user && (
|
{user && (
|
||||||
<Link href="/dashboard">
|
<Link href="/dashboard">
|
||||||
<a className="nav-btn">Dashboard</a>
|
<a className="nav-btn">Dashboard</a>
|
||||||
</Link>
|
</Link>
|
||||||
@@ -26,8 +31,8 @@ const Nav = (props: any) => {
|
|||||||
<a className="nav-btn">Contact Us</a>
|
<a className="nav-btn">Contact Us</a>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{props.user ? (
|
{user ? (
|
||||||
<button className="btn btn-xs text-xs" onClick={() => props.signOut()}>
|
<button className="btn btn-xs text-xs" onClick={() => signOut()}>
|
||||||
<LogOut size={12} className="mr-2" />
|
<LogOut size={12} className="mr-2" />
|
||||||
Logout
|
Logout
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -4,14 +4,19 @@ This card is used on the landing page
|
|||||||
|
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
|
|
||||||
const CardLanding = (props) => {
|
type CardLandingProps = {
|
||||||
const { image, title, text } = props;
|
image: string;
|
||||||
|
title: string;
|
||||||
|
text: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const CardLanding = ({ image, title, text }: CardLandingProps): JSX.Element => {
|
||||||
return (
|
return (
|
||||||
<div className="w-80 h-48 p-5 sm:ml-5 mb-5 bg-base-100 flex">
|
<div className="w-80 h-48 p-5 sm:ml-5 mb-5 bg-base-100 flex">
|
||||||
<div>
|
<div>
|
||||||
<div className="rounded-full w-12 h-12 border flex bg-neutral-content">
|
<div className="rounded-full w-12 h-12 border flex bg-neutral-content">
|
||||||
<div className="m-auto flex">
|
<div className="m-auto flex">
|
||||||
<Image src={image} width={24} height={24} />
|
<Image src={image} width={24} height={24} alt={`${title} logo`} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -4,12 +4,16 @@ This card is used on the landing page
|
|||||||
|
|
||||||
import { FiStar } from 'react-icons/fi';
|
import { FiStar } from 'react-icons/fi';
|
||||||
|
|
||||||
const KeyFeature = (props) => (
|
type KeyFeatureProps = {
|
||||||
|
children: JSX.Element;
|
||||||
|
};
|
||||||
|
|
||||||
|
const KeyFeature = ({ children }: KeyFeatureProps): JSX.Element => (
|
||||||
<div className="shadow-sm p-5 mb-5 bg-base-100 flex italic">
|
<div className="shadow-sm p-5 mb-5 bg-base-100 flex italic">
|
||||||
<div className="p-2 bg-accent-focus w-12 h-12 text-white rounded-sm my-auto flex">
|
<div className="p-2 bg-accent-focus w-12 h-12 text-white rounded-sm my-auto flex">
|
||||||
<FiStar className="text-2xl m-auto" />
|
<FiStar className="text-2xl m-auto" />
|
||||||
</div>
|
</div>
|
||||||
<div className="m-auto ml-3">{props.children}</div>
|
<div className="m-auto ml-3">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -3,36 +3,39 @@ import router from 'next/router';
|
|||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
const Login = (props) => {
|
type LoginProps = {
|
||||||
|
resetPassword: (email: string) => Promise<{ error: { message: string } }>;
|
||||||
|
signIn: ({}) => Promise<{ data: Record<string, unknown>; error: { message: string } }>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const Login = ({ resetPassword, signIn }: LoginProps): JSX.Element => {
|
||||||
const [email, setEmail] = useState('');
|
const [email, setEmail] = useState('');
|
||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState('');
|
||||||
const [forgot, setForgot] = useState(false);
|
const [forgot, setForgot] = useState(false);
|
||||||
|
|
||||||
const resetPassword = () => {
|
const resetPasswordLogin = () => {
|
||||||
props.resetPassword(email).then((result) => {
|
resetPassword(email).then((result: { error: { message: string } }) => {
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
toast.error(result.error.message);
|
toast.error(result.error.message);
|
||||||
} else toast.success('Check your email to reset your password!');
|
} else toast.success('Check your email to reset your password!');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const login = (e) => {
|
const login = (e: React.SyntheticEvent<HTMLButtonElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Handle the login. Go to the homepage if success or display an error.
|
// Handle the login. Go to the homepage if success or display an error.
|
||||||
props
|
signIn({
|
||||||
.signIn({
|
email,
|
||||||
email,
|
password,
|
||||||
password,
|
}).then((result: { data: Record<string, unknown>; error: { message: string } }) => {
|
||||||
})
|
if (result.data) {
|
||||||
.then((result) => {
|
router.push('/');
|
||||||
if (result.data) {
|
}
|
||||||
router.push('/');
|
if (result.error) {
|
||||||
}
|
toast.error(result.error.message);
|
||||||
if (result.error) {
|
}
|
||||||
toast.error(result.error.message);
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -99,11 +102,10 @@ const Login = (props) => {
|
|||||||
</span>
|
</span>
|
||||||
<div className="flex flex-col space-y-4">
|
<div className="flex flex-col space-y-4">
|
||||||
<button
|
<button
|
||||||
href="#"
|
|
||||||
className="flex items-center justify-center px-4 py-2 space-x-2 transition-colors duration-300 border border-base-200 rounded-md group hover:bg-base-300 focus:outline-none "
|
className="flex items-center justify-center px-4 py-2 space-x-2 transition-colors duration-300 border border-base-200 rounded-md group hover:bg-base-300 focus:outline-none "
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
props.signIn({ provider: 'google' });
|
signIn({ provider: 'google' });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="text-base-content">
|
<div className="text-base-content">
|
||||||
@@ -141,7 +143,7 @@ const Login = (props) => {
|
|||||||
className="btn btn-primary w-full btn-sm"
|
className="btn btn-primary w-full btn-sm"
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
resetPassword();
|
resetPasswordLogin();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Recover my password
|
Recover my password
|
||||||
Reference in New Issue
Block a user