Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
255 changes: 132 additions & 123 deletions src/sections/General/Navigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,135 +25,144 @@ import Layer5CloudLightIcon from "./utility/Layer5CloudLightIcon.svg";
import { IoIosArrowRoundForward } from "@react-icons/all-files/io/IoIosArrowRoundForward.js";

const Navigation = () => {
let data = useStaticQuery(
graphql`{
Learn: allMdx(
sort: {frontmatter: {date: DESC}}
filter: {fields: {collection: {eq: "service-mesh-books"}}}
limit: 2
) {
nodes {
id
frontmatter {
title
thumbnail {
childImageSharp {
gatsbyImageData(width: 1050, height: 1360, layout: CONSTRAINED)
let data = useStaticQuery(graphql`
{
Learn: allMdx(
sort: { frontmatter: { date: DESC } }
filter: { fields: { collection: { eq: "service-mesh-books" } } }
limit: 2
) {
nodes {
id
frontmatter {
title
thumbnail {
childImageSharp {
gatsbyImageData(width: 1050, height: 1360, layout: CONSTRAINED)
}
}
thumbnail_svg {
extension
publicURL
}
}
}
thumbnail_svg {
extension
publicURL
}
}
fields {
slug
}
}
}
Community: allMdx(
sort: {frontmatter: {date: DESC}}
filter: {fields: {collection: {eq: "events"}}, frontmatter: {published: {eq: true}}}
limit: 2
) {
nodes {
id
frontmatter {
title
thumbnail {
childImageSharp {
gatsbyImageData(
width: 240
height: 160
transformOptions: {cropFocus: CENTER}
layout: FIXED
)
fields {
slug
}
publicURL
extension
}
thumbnail_svg {
extension
publicURL
}
thumbnail_svg {
extension
publicURL
}
}
fields {
slug
}
}
}
Resources: allMdx(
sort: {frontmatter: {date: DESC}}
filter: {fields: {collection: {eq: "blog"}}, frontmatter: {featured: {eq: true}}}
limit: 2
) {
nodes {
id
frontmatter {
title
thumbnail {
childImageSharp {
gatsbyImageData(
width: 240
height: 160
transformOptions: {cropFocus: CENTER}
layout: FIXED
)
Community: allMdx(
sort: { frontmatter: { date: DESC } }
filter: {
fields: { collection: { eq: "events" } }
frontmatter: { published: { eq: true } }
}
limit: 2
) {
nodes {
id
frontmatter {
title
thumbnail {
childImageSharp {
gatsbyImageData(
width: 240
height: 160
transformOptions: { cropFocus: CENTER }
layout: FIXED
)
}
publicURL
extension
}
thumbnail_svg {
extension
publicURL
}
thumbnail_svg {
extension
publicURL
}
}
fields {
slug
}
publicURL
extension
}
thumbnail_svg {
extension
publicURL
}
Resources: allMdx(
sort: { frontmatter: { date: DESC } }
filter: {
fields: { collection: { eq: "blog" } }
frontmatter: { featured: { eq: true } }
}
thumbnail_svg {
extension
publicURL
limit: 2
) {
nodes {
id
frontmatter {
title
thumbnail {
childImageSharp {
gatsbyImageData(
width: 240
height: 160
transformOptions: { cropFocus: CENTER }
layout: FIXED
)
}
publicURL
extension
}
thumbnail_svg {
extension
publicURL
}
thumbnail_svg {
extension
publicURL
}
}
fields {
slug
}
}
}
fields {
slug
}
}
}
Home: allMdx(
sort: {frontmatter: {date: DESC}}
filter: {fields: {collection: {eq: "projects"}}, frontmatter: {published: {eq: true}}}
limit: 2
) {
nodes {
id
frontmatter {
title
thumbnail {
childImageSharp {
gatsbyImageData(
width: 240
height: 160
transformOptions: {cropFocus: CENTER}
layout: FIXED
)
}
extension
publicURL
Home: allMdx(
sort: { frontmatter: { date: DESC } }
filter: {
fields: { collection: { eq: "projects" } }
frontmatter: { published: { eq: true } }
}
thumbnail_svg {
extension
publicURL
limit: 2
) {
nodes {
id
frontmatter {
title
thumbnail {
childImageSharp {
gatsbyImageData(
width: 240
height: 160
transformOptions: { cropFocus: CENTER }
layout: FIXED
)
}
extension
publicURL
}
thumbnail_svg {
extension
publicURL
}
}
fields {
slug
}
}
}
fields {
slug
}
}
}
}`
);
`);
const { isDark, toggleDark } = useStyledDarkMode();
data["Products"] = {
nodes: [
Expand Down Expand Up @@ -210,12 +219,12 @@ const Navigation = () => {
cookieName + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
}
useEffect(() => {
const CLOUD_USER_API =
"https://cloud.layer5.io/api/identity/users/profile";
const CLOUD_USER_API = "https://cloud.layer5.io/api/identity/users/profile";
const fetchData = async () => {
try {
const token = getCookieValue("provider_token");
if (!token) { // no token: don't proceed
if (!token) {
// no token: don't proceed
return;
}
const response = await axios.get(CLOUD_USER_API, {
Expand Down Expand Up @@ -254,7 +263,8 @@ const Navigation = () => {
}
};

expand && setTimeout(() => document.addEventListener("click", outsideClickHandler));
expand &&
setTimeout(() => document.addEventListener("click", outsideClickHandler));

return () => {
document.removeEventListener("click", outsideClickHandler);
Expand All @@ -263,7 +273,7 @@ const Navigation = () => {

useEffect(() => {
window.addEventListener("scroll", () =>
window.scrollY > 50 ? setScroll(true) : setScroll(false)
window.scrollY > 50 ? setScroll(true) : setScroll(false),
);
}, []);

Expand Down Expand Up @@ -413,7 +423,7 @@ const Navigation = () => {
<IoIosArrowRoundForward />
</span>
</Link>
)
),
)}
</ul>
</li>
Expand Down Expand Up @@ -533,7 +543,6 @@ const Navigation = () => {
className="banner-btn two"
$external={true}
title="Get Started"
alt="Signup for Layer5 Cloud"
$url="https://cloud.layer5.io/registration"
/>
)}
Expand Down
Loading