diff --git a/public/img/404.png b/public/img/404.png new file mode 100644 index 0000000000000000000000000000000000000000..850d3ec602336378daf395c847bd2e603ec2c485 Binary files /dev/null and b/public/img/404.png differ diff --git a/src/pages/BlogPage.vue b/src/pages/BlogPage.vue index e85fa101ab2ed00fa0c8832e809a2488140ce4d9..848fd0ee0d660e77d5161b71e7545956ac6bfba6 100644 --- a/src/pages/BlogPage.vue +++ b/src/pages/BlogPage.vue @@ -9,7 +9,7 @@ <div class="absolute bg-gray-bg blur-[58px] rounded-[190px] w-[380px] h-[380px] z-0 -right-[82px] -top-[51px]" ></div> - + <section class="relative z-10 px-[6.7%] mt-6"> <router-link to="/blogs" @@ -57,10 +57,10 @@ export default { mounted() { window.addEventListener("scroll", this.onScroll); - if (!this.$route.params.id || !this.blogs[this.$route.params.id - 1]) { - this.$router.push("/blogs"); - return; - } + // if (!this.$route.params.id || !this.blogs[this.$route.params.id - 1]) { + // this.$router.push("/blogs"); + // return; + // } this.blog = this.blogs[this.$route.params.id - 1]; }, diff --git a/src/pages/NotFoundPage.vue b/src/pages/NotFoundPage.vue new file mode 100644 index 0000000000000000000000000000000000000000..4a2823753442fc0c0c8697546022a9e1c5857688 --- /dev/null +++ b/src/pages/NotFoundPage.vue @@ -0,0 +1,58 @@ +<template> + <div class="min-h-screen bg-cover bg-no-repeat bg-center bg-blend-multiply bg-gray-300 bg-[url('../public/img/404.png')]"> + <HeaderComponent + current-page="404" + transparent + text-white + ></HeaderComponent> + + <h1 class="text-white font-medium text-[3.375rem] leading-[4.5rem] mt-10 sm:mt-20 md:mt-[214px] w-max mx-auto relative"> + <FeatureLeftSvg class="absolute -translate-x-[91%] w-[51px] h-[51px] text-blue -top-[25px]"></FeatureLeftSvg> + Oops! + </h1> + <p class="mt-2 text-white leading-[1.625rem] text-center text-lg w-auto mx-auto"> + It looks like something went wrong <br> +Reload the page or return to the home screen + </p> + <div class="flex justify-center mt-[30px]"> + <router-link to="/" class="text-white rounded leading-[1.813rem] text-lg py-[14px] px-10 text-center w-max bg-blue hover:bg-blue-700 transition-colors"> + Go to main page + </router-link> + </div> + + </div> +</template> + +<script> +import HeaderComponent from "../components/HeaderComponent.vue"; +import FeatureLeftSvg from "../components/svg/FeatureLeftSvg.vue"; + +export default { + name: "NotFoundPage", + data() { + return { + scroll: window.scrollY, + blog: {}, + }; + }, + mounted() { + window.addEventListener("scroll", this.onScroll); + + if (!this.$route.params.id || !this.blogs[this.$route.params.id - 1]) { + this.$router.push("/blogs"); + return; + } + + this.blog = this.blogs[this.$route.params.id - 1]; + }, + beforeDestroy() { + window.removeEventListener("scroll", this.onScroll); + }, + methods: { + onScroll() { + this.scroll = window.scrollY; + }, + }, + components: { HeaderComponent, FeatureLeftSvg }, +}; +</script> diff --git a/src/plugins/router.js b/src/plugins/router.js index 3af7c697a363fb6c4da7b5c63002f90ede3040ae..5b181d94a1ab84aedfe88af39906055392bf38c3 100644 --- a/src/plugins/router.js +++ b/src/plugins/router.js @@ -4,6 +4,7 @@ import HomePage from "../pages/HomePage"; import ServicesPage from "../pages/ServicesPage"; import BlogsPage from "../pages/BlogsPage"; import BlogPage from "../pages/BlogPage"; +import NotFoundPage from "../pages/NotFoundPage"; Vue.use(VueRouter); const router = new VueRouter({ @@ -24,6 +25,10 @@ const router = new VueRouter({ path: "/blogs/:id", component: BlogPage, }, + { + path: "/:pathMatch(.*)*", + component: NotFoundPage, + }, ], mode: "history", });