Skip to content

Commit

Permalink
Merge pull request #18 from SkynetLabs/sky-1043
Browse files Browse the repository at this point in the history
Fix text in sticky header overlapping with content below
  • Loading branch information
MSevey authored Jun 27, 2022
2 parents 3259b66 + b427c1f commit cea15c7
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/Layout/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const FixedHeader = ({ uri }) => {
}, [setMode, mode, y, uri]);

return (
<div ref={ref} className="fixed inset-x-0 top-0 z-50">
<div ref={ref} className="sticky top-0 z-50">
<NewsHeader />
{mode && <Navigation mode={mode} uri={uri} />}
</div>
Expand All @@ -51,7 +51,7 @@ const Layout = ({ children, uri }) => {
// `);

return (
<div className="background bg-top bg-contain">
<div className="background bg-top bg-cover desktop:bg-contain">
<FixedHeader uri={uri} />
<main>{children}</main>
<FooterNavigation />
Expand Down
4 changes: 1 addition & 3 deletions src/components/Layout/Section.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export const Section = ({
children,
className,
width = "content",
first = false,
marginBottom = true,
marginTop = true,
...props
Expand All @@ -15,8 +14,7 @@ export const Section = ({
className={classnames(
"px-8",
{
"pt-32 desktop:pt-48": marginTop && first, // + navigation offset => pt-32 desktop:pt-48
"pt-12 desktop:pt-24": marginTop && !first,
"pt-12 desktop:pt-24": marginTop,
"pb-12 desktop:pb-24": marginBottom,
},
className
Expand Down
6 changes: 5 additions & 1 deletion src/components/Navigation/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ const Navigation = ({ mode, uri }) => {
<nav
className={classnames("relative px-8 py-6 transition-all duration-500", {
"bg-white border-b border-palette-200": mode === "light",
"bg-palette-600 bg-opacity-50": mode === "dark",
"bg-palette-600": mode === "dark",
// On mobile, when user starts scrolling we want the sticky navigation bar's background to be a solid solid, as text may overlap and become unreadable.
"bg-opacity-50": mode === "dark" && isWindowTop,
// On desktop, navigation can be semi-transparent at all times, as the text is unlikely to collide with the text below.
"desktop:bg-opacity-50": mode === "dark",
"desktop:py-12": isWindowTop,
})}
ref={navRef}
Expand Down
2 changes: 1 addition & 1 deletion src/components/NewsHeader/NewsHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const NewsHeader = () => {
<div className="flex justify-between">
<Link
{...link}
className="text-palette-300 font-content leading-8 flex items-center overflow-hidden text-base hover:text-primary transition-colors duration-200"
className="text-palette-300 font-content leading-8 overflow-hidden text-base hover:opacity-90 transition-opacity duration-200"
>
<ArrowRight className="mr-2 flex-shrink-0 fill-current text-primary" />
<span className="truncate">{title}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const IndexPage = () => {
<>
<Seo title="Decentralized Internet for a Free Future" />

<Section first={true}>
<Section>
<div className="text-center">
<h1 className="text-4xl desktop:text-6xl text-white">
Decentralized Internet
Expand Down
2 changes: 1 addition & 1 deletion src/pages/privacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const PrivacyPolicyPage = () => (
<>
<Seo title="Privacy Policy" />

<Section first={true} className="bg-white">
<Section className="bg-white">
<h1 className="capitalize">
<DomainName /> Privacy Policy
</h1>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const TermsPage = () => (
<>
<Seo title="Terms of Use" />

<Section first={true} className="bg-white">
<Section className="bg-white">
<h1 className="capitalize">
<DomainName /> Terms of Use
</h1>
Expand Down

0 comments on commit cea15c7

Please sign in to comment.