-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Added Route Not Found #50
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Layout, Typography } from "antd"; | ||
import { FC, useEffect, useState } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { Button } from "../../components/Button"; | ||
import { ACCESS_TOKEN_KEY } from "../../config"; | ||
import "./styles.css"; | ||
|
||
export const NotFound: FC = () => { | ||
const navigate = useNavigate(); | ||
|
||
const [isUserLogged, setIsUserLogged] = useState<boolean>(false); | ||
|
||
const [animateParagraph, setAnimateParagraph] = useState<boolean>(false); | ||
const [animateButton, setAnimateButton] = useState<boolean>(false); | ||
|
||
useEffect(() => { | ||
setIsUserLogged(localStorage[ACCESS_TOKEN_KEY] ? true : false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can remove this |
||
|
||
setTimeout(() => { | ||
setAnimateParagraph(true); | ||
|
||
setTimeout(() => { | ||
setAnimateButton(true); | ||
}, 800); | ||
}, 800); | ||
}, []); | ||
|
||
const handleRedirect = () => navigate(isUserLogged ? "/companies" : "/"); | ||
|
||
return ( | ||
<Layout.Content className="content"> | ||
<div className="container"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to use Space component from antd and see if it works correctly |
||
<Typography.Title className="title element-animation"> | ||
Ups, parece que andas perdido. | ||
</Typography.Title> | ||
<Typography.Paragraph | ||
className={ | ||
animateParagraph ? "element-animation paragraph" : "paragraph" | ||
} | ||
> | ||
Mas não te preocupes, nós ajudamos-te a voltar ao caminho certo. | ||
</Typography.Paragraph> | ||
|
||
{animateButton && ( | ||
<div className="element-animation"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here with Space |
||
<Button | ||
htmlType="button" | ||
styles={{ width: "100px", height: "40px" }} | ||
onClick={handleRedirect} | ||
children="Voltar" | ||
/> | ||
</div> | ||
)} | ||
</div> | ||
</Layout.Content> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.container { | ||
background-color: #ffffff !important; | ||
display: flex; | ||
align-items: center; | ||
flex-direction: column; | ||
padding-top: 24%; | ||
} | ||
|
||
.title { | ||
font-size: 2.5rem !important; | ||
font-weight: 700; | ||
} | ||
|
||
.paragraph { | ||
font-size: 1.1rem; | ||
font-weight: 500; | ||
opacity: 0; | ||
} | ||
|
||
.element-animation { | ||
animation: renderTextAnimation 1s ease-in-out; | ||
opacity: 1; | ||
} | ||
|
||
@keyframes renderTextAnimation { | ||
0% { | ||
opacity: 0; | ||
transform: translateY(40px); | ||
} | ||
100% { | ||
opacity: 1; | ||
transform: translateY(0); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useState(localStorage[ACCESS_TOKEN_KEY] ? true : false)