Skip to content

Commit

Permalink
Merge pull request #588 from canopas/mansi/manage-header-animation
Browse files Browse the repository at this point in the history
Impr: stop header animation for blog website
  • Loading branch information
cp-mansi-d authored Oct 25, 2024
2 parents 89bc6ea + 1e530a6 commit 35b5035
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 17 deletions.
24 changes: 24 additions & 0 deletions nuxt-frontend/assets/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,27 @@
font-weight: 600;
src: url(~/assets/fonts/Comme-SemiBold-Subset.woff2) format("woff2");
}

@font-face {
font-display: swap;
font-family: Helvetica-Light;
font-style: normal;
font-weight: 300;
src: url(~/assets/fonts/Helvetica-Light.woff2) format("woff2");
}

@font-face {
font-display: swap;
font-family: Helvetica-Regular;
font-style: normal;
font-weight: 400;
src: url(~/assets/fonts/Helvetica-Regular.woff2) format("woff2");
}

@font-face {
font-display: swap;
font-family: Helvetica-Bold;
font-style: normal;
font-weight: 700;
src: url(~/assets/fonts/Helvetica-Bold.woff2) format("woff2");
}
Binary file added nuxt-frontend/assets/fonts/Helvetica-Bold.woff2
Binary file not shown.
Binary file added nuxt-frontend/assets/fonts/Helvetica-Light.woff2
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions nuxt-frontend/assets/images/logo/logo-header-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion nuxt-frontend/components/Blog.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div :class="count == 0 || status == config.NOT_FOUND ? 'h-screen' : ''">
<Header />
<Header :animateOnScroll="false" />
<div
v-if="count == 0 || status == config.NOT_FOUND"
class="h-1/2 flex text-[1.4rem] text-black-900 items-center justify-center"
Expand Down
8 changes: 4 additions & 4 deletions nuxt-frontend/components/contributions/WeeklyUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default {
content:
"Welcome to Android Weekly — a newsletter on new development and updates of Android universe curated by Canopas team, delivered every Monday.",
color: "bg-lavender-blush",
url: "https://blog.canopas.com/tagged/canopas-android-weekly",
url: "https://medium.com/canopas/tagged/canopas-android-weekly",
translate: 0,
scale: 1,
event: "tap_contribution_android_weekly",
Expand All @@ -157,7 +157,7 @@ export default {
content:
"Welcome to iOS Weekly — a newsletter on new development and updates of the iOS universe curated by Canopas team, delivered every Monday.",
color: "bg-white-smoke",
url: "https://blog.canopas.com/tagged/canopas-ios-weekly",
url: " https://medium.com/canopas/tagged/canopas-ios-weekly",
translate: 40,
scale: 1,
event: "tap_contribution_ios_weekly",
Expand All @@ -171,7 +171,7 @@ export default {
content:
"Welcome to Web weekly — a weekly newsletter on new development and updates of Web universe curated by Canopas team, delivered every Monday.",
color: "bg-lavender-blush",
url: "https://blog.canopas.com/tagged/canopas-web-weekly",
url: " https://medium.com/canopas/tagged/canopas-web-weekly",
translate: 80,
scale: 1,
event: "tap_contribution_web_weekly",
Expand All @@ -185,7 +185,7 @@ export default {
content:
"Welcome to Flutter Weekly — a newsletter on new development and updates of Flutter universe curated by Canopas team, delivered every Monday.",
color: "bg-white-smoke",
url: "https://blog.canopas.com/tagged/canopas-flutter-weekly",
url: " https://medium.com/canopas/tagged/canopas-flutter-weekly",
translate: 120,
scale: 1,
event: "tap_contribution_flutter_weekly",
Expand Down
29 changes: 18 additions & 11 deletions nuxt-frontend/components/partials/NewHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@

<script type="module">
export default {
props: {
animateOnScroll: {
type: Boolean,
default: true, // Default to true if not provided
},
},
data() {
return {
id: this.$route.params.id,
Expand Down Expand Up @@ -309,27 +315,28 @@ export default {
},
mounted() {
this.navContainerHeight = this.$refs.mainHeader.clientHeight;
if (
this.currentRoutePath.includes("portfolio/") &&
window.innerWidth > 992 &&
!["/portfolio", "/portfolio/"].includes(this.currentRoutePath)
) {
this.podcastRef = document.getElementById("response");
this.podcastRef.style.marginTop = -this.navContainerHeight + "px";
this.podcastRef.addEventListener("scroll", this.handleScroll);
// Only add the scroll event listener if animation is enabled
if (this.animateOnScroll) {
window.addEventListener("scroll", this.handleScroll);
}
window.addEventListener("scroll", this.handleScroll);
this.width = window.innerWidth;
},
unmounted() {
if (this.podcastRef) {
if (this.animateOnScroll && this.podcastRef) {
this.podcastRef.removeEventListener("scroll", this.handleScroll);
}
window.removeEventListener("scroll", this.handleScroll);
},
inject: ["mixpanel"],
methods: {
handleScroll() {
// Only animate the navbar if the prop allows it
if (!this.animateOnScroll) {
this.showNavbar = true;
this.animateNavbar = true;
return;
}
let scrollY = this.podcastRef
? this.podcastRef.scrollTop
: window.scrollY;
Expand Down
2 changes: 1 addition & 1 deletion nuxt-frontend/pages/[slug].vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div v-if="!assets">
<Header />
<Header :animateOnScroll="false" />
<div :class="post.is_resource ? '' : 'container pl-0'">
<BlogDetail
:mixpanel="$mixpanel"
Expand Down
3 changes: 3 additions & 0 deletions nuxt-frontend/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ module.exports = {
"comme-regular": ["Comme-Regular"],
"comme-medium": ["Comme-Medium"],
"comme-semibold": ["Comme-SemiBold"],
"helvetica-light": ["Helvetica-Light"],
"helvetica-regular": ["Helvetica-Regular"],
"helvetica-Bold": ["Helvetica-Bold"],
},
letterSpacing: {
"extra-wider": "0.0625em",
Expand Down

0 comments on commit 35b5035

Please sign in to comment.