Skip to content

Commit 577da3c

Browse files
author
vishalvivekm
committed
enhance-component-to-dynamically-query-data-from-collections
Signed-off-by: vishalvivekm <[email protected]>
1 parent 5ce4010 commit 577da3c

File tree

3 files changed

+56
-4
lines changed

3 files changed

+56
-4
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Brainstorm with commenting
3+
abstract: "MeshMap's Designer Mode offers a powerful collaboration feature through comments."
4+
thumbnail: ../../../assets/images/comments/comment.svg
5+
eurl: https://layer5.io/cloud-native-management/meshmap/collaborate/peer-reviews
6+
category: usecase
7+
status: delivered
8+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Whiteboarding
3+
abstract: "The Whiteboardingg and Freestyle Drawing feature introduces versatile drawing capabilities within MeshMap"
4+
thumbnail: ../../../assets/images/whiteboard/whiteboard.svg
5+
eurl: https://layer5.io/architecture-diagram/design-architecture-diagramm
6+
category: usecase
7+
status: delivered
8+
---

src/components/RelatedPicks/index.js

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from "react";
2+
import { graphql, useStaticQuery } from "gatsby";
23
import { Container, Wrapper, CardWrapper, CardImageContainer, Image, CardTitle } from "./style";
4+
import { useStyledDarkMode } from "../../theme/app/useStyledDarkMode";
35

46
import { Link } from "gatsby";
57

@@ -18,17 +20,51 @@ const Card = ({ title, imgSrc, redirectLink }) => {
1820
);
1921
};
2022

21-
const RelatedPicks = ({ content }) => {
23+
const RelatedPicks = ({ heading }) => {
24+
const { isDark } = useStyledDarkMode();
25+
26+
const data = useStaticQuery(
27+
graphql `query allUseCases {
28+
allMdx(
29+
filter: {fields: {collection: {eq: "use-cases"}}, frontmatter: {category: {eq: "supportedplatform"}}}
30+
) {
31+
nodes {
32+
id
33+
frontmatter {
34+
title
35+
redirectLink
36+
darkimgsrc {
37+
childImageSharp {
38+
gatsbyImageData(layout: FULL_WIDTH)
39+
}
40+
extension
41+
publicURL
42+
}
43+
lightimgsrc {
44+
childImageSharp {
45+
gatsbyImageData(layout: FULL_WIDTH)
46+
}
47+
extension
48+
publicURL
49+
}
50+
category
51+
}
52+
}
53+
}
54+
}`
55+
);
2256

2357
return (
2458
<>
2559
<Container>
2660
<h2>Other Supported Platforms</h2>
2761
<Wrapper>
2862
{
29-
content.map(item => (
30-
<Card key={item.id} title={item.title} imgSrc={item.imgSrc} redirectLink={item.redirectLink}/>
31-
))
63+
data.allMdx.nodes
64+
.filter(item => item.frontmatter.title.split(" ")[0].toLowerCase() !== heading)
65+
.map(item => (
66+
<Card key={item.id} title={item.frontmatter.title} imgSrc={ isDark ? item.frontmatter.darkimgsrc.publicURL : item.frontmatter.lightimgsrc.publicURL } redirectLink={item.frontmatter.redirectLink}/>
67+
))
3268
}
3369
</Wrapper>
3470
</Container>

0 commit comments

Comments
 (0)