Skip to content

Commit 0a213db

Browse files
authored
Fix/structuring basic resources (#56)
* structuring basic tools and unfiltering * ordering basic resources titles
1 parent 1c63288 commit 0a213db

File tree

7 files changed

+42
-31
lines changed

7 files changed

+42
-31
lines changed

src/components/cards/Canvas.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ const CardCanvas = ({ data, blockHeight, columns }: any) => {
3535
return (
3636
<div
3737
style={{
38-
height: `${blockHeight * 12.5}rem`,
38+
height: `${blockHeight * 6}rem`,
39+
maxHeight: `${blockHeight * 12.5}rem`,
40+
3941
width: "auto",
4042
position: "relative",
4143
zIndex: 20,
42-
marginTop: 10,
44+
// marginTop: 10,
4345
padding: 0,
4446
}}
45-
className="flex justify-center"
47+
className="flex justify-center "
4648
>
49+
4750
<ReactFlow
4851
nodes={nodes}
4952
nodeTypes={NodeTypes}

src/data/basic-tools/approaches.ts

+14-10
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ const rawApproaches = output
88
.filter((approach) => approach) as string[];
99

1010
export const approaches = Array.from(new Set(rawApproaches)).map(
11-
(approach: string) => {
12-
const data = toolsData[approach.toUpperCase()];
13-
const entries = output.filter((entry) => entry?.PARSED_MANUAL_TAGS?.TOOLS?.includes(approach)
14-
);
15-
return {
16-
title: approach,
17-
description: data?.description,
18-
entries,
19-
};
20-
}
11+
(approach: string) => {
12+
const data = toolsData[approach.toUpperCase()];
13+
const entries = output
14+
.filter((entry) => entry?.PARSED_MANUAL_TAGS?.TOOLS?.includes(approach))
15+
.map((entry) => ({
16+
...entry,
17+
hasDefaultBackground: true,
18+
}));
19+
return {
20+
title: approach,
21+
description: data?.description,
22+
entries,
23+
};
24+
}
2125
) as unknown as Block[];

src/data/resources/basic-resources.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ const groups: Group[] = Object.keys(rawGroups).map((group) => {
1717
title: group,
1818
blocks: rawGroups[group]
1919
};
20-
}).sort((a, b) => a.title.localeCompare(b.title)) as unknown as Group[];
20+
}) as unknown as Group[];
2121

2222
export default groups;

src/pages/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Group from "@/components/Group";
22
import resources from "@/data/resources/advanced-resources";
3-
// import Grou
43

54

65

src/pages/tools-resources.tsx

+17-12
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ import tools from "../data/basic-tools";
44

55
const ToolsResources = () => {
66
return (
7-
<section className="mt-10 flex gap-y-8 px-8 flex-wrap">
8-
{tools.map((data: any, i: any) =>
9-
<div key={`${data.title}-${i}`} className="w-1/2 px-4 h-1/2">
10-
<Block
11-
title={data.title}
12-
description={data.description}
13-
entries={data.entries}
14-
/>
15-
</div>
16-
)}
17-
18-
7+
<section className="mt-10 grid grid-cols-3 gap-y-8 px-8 flex-wrap ">
8+
{tools.map((data: any, i: any) => {
9+
return (
10+
<div
11+
key={`${data.title}-${i}`}
12+
className={`${
13+
data.title === "Basic Tools" ? "col-span-2 row-span-3 flex justify-center items-center" : ""
14+
} px-4 `}
15+
>
16+
<Block
17+
title={data.title}
18+
description={data.description}
19+
entries={data.entries}
20+
/>
21+
</div>
22+
);
23+
})}
1924
</section>
2025
);
2126
};

src/types/interfaces.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export interface Entry {
2222
tags: string;
2323
PARSED_MANUAL_TAGS: ParsedManualTags;
2424
PARSED_RELATES_TO?: string[];
25-
isBasicTool?: Boolean
25+
isBasicTool?: Boolean;
26+
hasDefaultBackground?: Boolean
2627
}
2728

2829
export type Entries = Entry[];

src/utils/nodes.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ export const getBgColorClassName = (level: any) => {
3939
};
4040

4141
export const getNodeBgColorClassName = (entry: Entry) => {
42-
console.log(entry)
4342

4443
if(entry.isBasicTool) return classNames("bg-[#f8cecc] border-[#b85450]");
45-
46-
const level = getLevel(entry);
44+
45+
const level = !entry.hasDefaultBackground ? getLevel(entry) : '';
4746
return getBgColorClassName(level);
4847
};

0 commit comments

Comments
 (0)