Skip to content

Commit 6389d87

Browse files
jyash97CompuIves
authored andcommitted
fix: Blog Link and Blogs Query on Homepage (codesandbox#2207)
* fix: Blog Link and Blogs Query * fix: Remove unused utils method
1 parent 500c853 commit 6389d87

File tree

3 files changed

+61
-46
lines changed
  • packages
    • app/src/app/pages/common/Modals/Changelog/Dashboard
    • common/src/components
    • homepage/src/screens/home/RecentPublications

3 files changed

+61
-46
lines changed

packages/app/src/app/pages/common/Modals/Changelog/Dashboard/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ function DashboardChangelog({ signals }) {
5252
}}
5353
>
5454
<div
55-
style={{ marginBottom: '1rem', display: 'flex', alignItems: 'center' }}
55+
style={{
56+
marginBottom: '1rem',
57+
display: 'flex',
58+
alignItems: 'center',
59+
}}
5660
>
5761
<h1 style={titleStyles}>
5862
What
@@ -133,7 +137,7 @@ function DashboardChangelog({ signals }) {
133137
Close
134138
</Button>
135139
<Button
136-
href="https://medium.com/@compuives/announcing-codesandbox-dashboard-teams-876f5933160b"
140+
href="/post/announcing-codesandbox-dashboard-teams"
137141
style={{ marginTop: '1rem', marginLeft: '.25rem' }}
138142
block
139143
small

packages/common/src/components/Footer.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,7 @@ export default () => (
9191
<Title>About</Title>
9292
<List>
9393
<li>
94-
<a
95-
href="https://medium.com/@compuives"
96-
target="_blank"
97-
rel="noopener noreferrer"
98-
>
94+
<a href="/blog" target="_blank" rel="noopener noreferrer">
9995
Blog
10096
</a>
10197
</li>

packages/homepage/src/screens/home/RecentPublications/index.js

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -90,54 +90,69 @@ export default () => (
9090
<StaticQuery
9191
query={graphql`
9292
query {
93-
allMediumPost(limit: 3, sort: { fields: [createdAt], order: DESC }) {
93+
allMarkdownRemark(
94+
filter: { fileAbsolutePath: { regex: "/articles/" } }
95+
limit: 3
96+
) {
9497
edges {
9598
node {
9699
id
97-
title
98-
uniqueSlug
99-
virtuals {
100-
subtitle
101-
previewImage {
102-
imageId
100+
html
101+
frontmatter {
102+
featuredImage {
103+
publicURL
103104
}
105+
slug
106+
authors
107+
photo
108+
title
109+
description
110+
date
104111
}
105112
}
106113
}
107114
}
108115
}
109116
`}
110-
render={({ allMediumPost: { edges } }) => (
111-
<Container>
112-
<MaxWidth width={1280}>
113-
<Title>Recent Publications</Title>
114-
<SubTitle>
115-
You can follow{' '}
116-
<a
117-
href="https://medium.com/@compuives/"
118-
target="_blank"
119-
rel="noreferrer noopener"
120-
style={{ textDecoration: 'none' }}
121-
>
122-
our blog
123-
</a>{' '}
124-
to stay up to date with new publications.
125-
</SubTitle>
126-
<Items style={{ marginBottom: '2rem' }}>
127-
{edges.map(post => (
128-
<PublicationItem
129-
key={post.node.id}
130-
title={post.node.title}
131-
description={post.node.virtuals.subtitle}
132-
url={`https://medium.com/@compuives/${post.node.uniqueSlug}`}
133-
image={`https://cdn-images-1.medium.com/max/2000/${
134-
post.node.virtuals.previewImage.imageId
135-
}`}
136-
/>
137-
))}
138-
</Items>
139-
</MaxWidth>
140-
</Container>
141-
)}
117+
render={({ allMarkdownRemark }) => {
118+
const { edges } = allMarkdownRemark;
119+
const posts = edges
120+
.map(({ node }) => ({
121+
id: node.id,
122+
...node.frontmatter,
123+
}))
124+
.sort((a, b) => new Date(b.date) - new Date(a.date));
125+
126+
return (
127+
<Container>
128+
<MaxWidth width={1280}>
129+
<Title>Recent Publications</Title>
130+
<SubTitle>
131+
You can follow{' '}
132+
<a
133+
href="/blog"
134+
target="_blank"
135+
rel="noreferrer noopener"
136+
style={{ textDecoration: 'none' }}
137+
>
138+
our blog
139+
</a>{' '}
140+
to stay up to date with new publications.
141+
</SubTitle>
142+
<Items style={{ marginBottom: '2rem' }}>
143+
{posts.map(post => (
144+
<PublicationItem
145+
key={post.id}
146+
title={post.title}
147+
description={post.description}
148+
url={`/post/${post.slug}`}
149+
image={post.featuredImage.publicURL}
150+
/>
151+
))}
152+
</Items>
153+
</MaxWidth>
154+
</Container>
155+
);
156+
}}
142157
/>
143158
);

0 commit comments

Comments
 (0)