Skip to content

Commit 56b6f84

Browse files
committed
Goals: add category sorting
1 parent bedbbc1 commit 56b6f84

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/pages/main/goals.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const Goals = () => {
6565
query {
6666
allGoalsYaml {
6767
nodes {
68+
id
6869
title
6970
description
7071
goals {
@@ -89,6 +90,7 @@ const Goals = () => {
8990
`
9091
)
9192

93+
const sortedCategories = data.allGoalsYaml.nodes.sort((a, b) => a.id - b.id);
9294
const allGoals = data.allGoalsYaml.nodes.map(node => node.goals);
9395
const goalsConcat = [].concat(...allGoals);
9496

@@ -153,7 +155,7 @@ const Goals = () => {
153155
<p></p>
154156
</div>
155157
<p style={placeholderTop}> </p>
156-
{data.allGoalsYaml.nodes.map((category) => (
158+
{sortedCategories.map((category) => (
157159
<GoalCategory
158160
array={category.goals}
159161
name={category.title}

0 commit comments

Comments
 (0)