Skip to content

Commit

Permalink
chore: Fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alexronquillo committed Oct 22, 2021
1 parent 7e0869d commit de918b2
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/templates/LabOverviewTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ const LabOverviewTemplate = ({ data, location }) => {
const { frontmatter, body } = mdx;
const { title, description } = frontmatter;

function sortProcedures(a, b) {
if (a.frontmatter.procIdx > b.frontmatter.procIdx) {
return 1;
}

if (a.frontmatter.procIdx < b.frontmatter.procIdx) {
return -1;
}

return 0;
}

return (
<>
<DevSiteSeo title={title} description={description} location={location} />
Expand All @@ -28,25 +40,16 @@ const LabOverviewTemplate = ({ data, location }) => {
<GuideListing className={styles.guideListing}>
<GuideListing.List className={styles.labGuideList}>
{guides?.nodes
.sort((a, b) =>
a.frontmatter.procIdx > b.frontmatter.procIdx
? 1
: a.frontmatter.procIdx < b.frontmatter.procIdx
? -1
: 0
)
.sort(sortProcedures)
.map(({ frontmatter }, index) => (
<GuideTile
className={styles.labGuideCard}
to={frontmatter.path}
key={index}
duration={frontmatter.duration}
title={
frontmatter.procIdx +
'. ' +
(frontmatter.tileShorthand?.title ||
frontmatter.title)
}
title={`${frontmatter.procIdx}. ${
frontmatter.tileShorthand?.title || frontmatter.title
}`}
description={
frontmatter.tileShorthand?.description ||
frontmatter.description
Expand Down

0 comments on commit de918b2

Please sign in to comment.