Skip to content

Commit

Permalink
Implement QA comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyi committed Jul 24, 2024
1 parent eff7b91 commit bc1ee16
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions site/DataInsightsNewsletterBanner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@
opacity: 1;
pointer-events: auto;
}

// We need a separate class without `opacity: 0` for hiding to animate.
&--hiding {
transform: translateY(100%);
}
}
8 changes: 7 additions & 1 deletion site/DataInsightsNewsletterBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const COOKIE_NAME = "is_data_insights_newsletter_banner_hidden"

export default function DataInsightsNewsletterBanner() {
const [isVisible, setIsVisible] = useState(false)
const [isHiding, setIsHiding] = useState(false)

useEffect(() => {
const keepHidden = Cookies.get(COOKIE_NAME)
Expand All @@ -20,14 +21,19 @@ export default function DataInsightsNewsletterBanner() {
}, [])

function handleOnClose() {
setIsVisible(false)
setIsHiding(true)
Cookies.set(COOKIE_NAME, "true", { expires: 90 })
setTimeout(() => {
setIsVisible(false)
setIsHiding(false)
}, 300) // This should match the transition duration in CSS
}

return (
<DataInsightsNewsletter
className={cx("data-insights-newsletter-banner", {
"data-insights-newsletter-banner--visible": isVisible,
"data-insights-newsletter-banner--hiding": isHiding,
})}
context={NewsletterSubscriptionContext.FloatingDataInsights}
onClose={handleOnClose}
Expand Down
6 changes: 5 additions & 1 deletion site/gdocs/pages/DataInsight.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
font-size: 0.875rem;
a {
@include owid-link-90;

&:visited {
color: $blue-90; // Don't change the color.
}
}
svg {
height: 12px;
Expand All @@ -26,7 +30,7 @@
}

@include sm-only {
margin: 24px 0;
margin: 16px 0 20px 0;
}
}

Expand Down

0 comments on commit bc1ee16

Please sign in to comment.