[feat] change back button

This commit is contained in:
Alvalen 2023-09-06 16:39:25 +07:00
parent 81210ab77f
commit 5a87f0c3e9
6 changed files with 29 additions and 10 deletions

View file

@ -103,7 +103,9 @@ const MyPage = () => {
Download CV Download CV
</Button> </Button>
<Button variation="secondary"> <Button variation="secondary">
<a href="#contact">
Contact Me Contact Me
</a>
</Button> </Button>
</motion.div> </motion.div>
</motion.div> </motion.div>

View file

@ -22,7 +22,7 @@ export default function Page() {
const handleBack = () => { const handleBack = () => {
window.history.back(); window.location.href = "/";
}; };
return ( return (
<> <>

View file

@ -7,6 +7,8 @@ import { faGithub } from "@fortawesome/free-brands-svg-icons";
import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons"; import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
import NotFound from "@/app/not-found"; import NotFound from "@/app/not-found";
import Image from "next/image"; import Image from "next/image";
import FixedButon from "@/components/FixedButton";
import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";
function Page({ params }) { function Page({ params }) {
const [data, setData] = useState(null); const [data, setData] = useState(null);
@ -28,7 +30,6 @@ function Page({ params }) {
</> </>
); );
} else if (!data) { } else if (!data) {
// skleton loading
return ( return (
<div className="relative min-h-screen w-full gap-4 p-10 flex justify-center items-center flex-col mb-10 "> <div className="relative min-h-screen w-full gap-4 p-10 flex justify-center items-center flex-col mb-10 ">
<div className="min-h-screen flex justify-center items-center w-full"> <div className="min-h-screen flex justify-center items-center w-full">
@ -54,9 +55,17 @@ function Page({ params }) {
</div> </div>
); );
} }
const handleBack = () => {
window.history.back();
};
return ( return (
<div className="relative min-h-screen w-full gap-4 p-10 flex justify-center items-center flex-col mb-10 "> <div className="relative min-h-screen w-full gap-4 p-10 flex justify-center items-center flex-col mb-10 ">
<FixedButon onClick={handleBack}>
<FontAwesomeIcon
icon={faChevronLeft}
className="text-black pr-10"
/>
</FixedButon>
<div className="min-h-screen flex justify-center items-center"> <div className="min-h-screen flex justify-center items-center">
<div className="mx-auto grid grid-cols-1 md:grid-cols-2 mt-10 md:mt-0"> <div className="mx-auto grid grid-cols-1 md:grid-cols-2 mt-10 md:mt-0">
<div className="flex justify-center items-start flex-col mb-5 space-y-10 mx-auto"> <div className="flex justify-center items-start flex-col mb-5 space-y-10 mx-auto">

View file

@ -4,7 +4,8 @@ import { motion } from "framer-motion";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faGithub } from "@fortawesome/free-brands-svg-icons"; import { faGithub } from "@fortawesome/free-brands-svg-icons";
import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons"; import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
import FixedButon from "@/components/FixedButton";
import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";
const projects = [ const projects = [
{ {
year: "2023", year: "2023",
@ -84,9 +85,18 @@ const projects = [
}, },
]; ];
export default function Page () { export default function Page () {
const handleBack = () => {
window.history.back();
};
return ( return (
<> <>
<main className="overflow-hidden"> <main className="overflow-hidden">
<FixedButon onClick={handleBack}>
<FontAwesomeIcon
icon={faChevronLeft}
className="text-black pr-10"
/>
</FixedButon>
<div className="min-h-screen w-screen mt-10 md:mt-0 p-10 flex justify-center items-center flex-col mb-10"> <div className="min-h-screen w-screen mt-10 md:mt-0 p-10 flex justify-center items-center flex-col mb-10">
<div className="flex justify-center items-center flex-col my-5 self-start "> <div className="flex justify-center items-center flex-col my-5 self-start ">
<motion.div <motion.div
@ -171,9 +181,7 @@ export default function Page () {
)} )}
{project.preview && ( {project.preview && (
<a <a
href={ href={project.preview}
project.preview
}
title="Link to project preview"> title="Link to project preview">
<FontAwesomeIcon <FontAwesomeIcon
icon={ icon={

View file

@ -89,7 +89,7 @@ export default function Page() {
window.scrollTo(0, 0); window.scrollTo(0, 0);
}, []); }, []);
const handleBack = () => { const handleBack = () => {
window.history.back(); window.location.href = "/";
}; };
return ( return (
<> <>

View file

@ -7,7 +7,7 @@ export default function Hr() {
className="bg-gray-700 w-20 h-1 rounded-full mb-2" className="bg-gray-700 w-20 h-1 rounded-full mb-2"
initial={{ initial={{
opacity: 0, opacity: 0,
x: -50, x: -45,
}} }}
whileInView={{ whileInView={{
opacity: 1, opacity: 1,