Skip to content

Commit 60d12f7

Browse files
committed
add
1 parent 69de6f4 commit 60d12f7

File tree

7 files changed

+162
-109
lines changed

7 files changed

+162
-109
lines changed

content/tools/_index.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
---
22
title: "Tools"
33
description: "A collection of tools categorized and sorted for your convenience."
4+
toc: false
5+
width: full
46
---
5-
{{< grid-view data="tools" >}}
7+
<div class="w-full">
8+
{{< grid-view cardsPerRow="4" data="tools" >}}
9+
</div>
10+

data/tools.yaml

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- category: Static Analysis
1+
- category: Dynamic Analysis
22
tools:
33
- name: Black
44
description: The uncompromising Python code formatter
@@ -150,14 +150,15 @@
150150
- name: mythril
151151
description: Security analysis tool for Ethereum smart contracts.
152152
url: https://github.com/ConsenSysDiligence/mythril
153-
154-
153+
- category: Static Analysis
154+
tools:
155+
- name: Microsoft IntelliTest
156+
description: Generate a candidate suite of tests for your .NET code.
157+
url: https://black.readthedocs.io/en/stable
155158

156159

157160

158161

159-
160-
161162

162163

163164

layouts/partials/custom/navbar.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
{{- $logoDarkPath := .Site.Params.navbar.logo.dark | default $logoPath -}}
66
{{- $displayThemeToggle := site.Params.theme.displayToggle | default true -}}
77

8-
{{- $navWidth := "max-w-[90rem]" -}}
8+
{{- $navWidth := "" -}} {{/* Remove the max-w classes */}}
99
{{- with .Site.Params.navbar.width -}}
1010
{{ if eq . "normal" -}}
11-
{{ $navWidth = "max-w-screen-xl" -}}
11+
{{ $navWidth = "" -}} {{/* Remove the max-w classes */}}
1212
{{ else if eq . "full" -}}
13-
{{ $navWidth = "max-w-full" -}}
13+
{{ $navWidth = "" -}} {{/* Remove the max-w classes */}}
1414
{{ end -}}
1515
{{- end -}}
1616

1717
<div class="nav-container sticky top-0 z-20 w-full bg-transparent print:hidden">
1818
<div class="nav-container-blur pointer-events-none absolute z-[-1] h-full w-full bg-white dark:bg-dark shadow-[0_2px_4px_rgba(0,0,0,.02),0_1px_0_rgba(0,0,0,.06)] contrast-more:shadow-[0_0_0_1px_#000] dark:shadow-[0_-1px_0_rgba(255,255,255,.1)_inset] contrast-more:dark:shadow-[0_0_0_1px_#fff]"></div>
1919

20-
<nav class="mx-auto flex items-center justify-end gap-2 h-16 px-6 {{ $navWidth }}">
20+
<nav class="mx-auto flex items-center justify-end gap-2 h-16 px-6 {{ $navWidth }}"> {{/* Remove the max-w classes */}}
2121
<a class="flex items-center hover:opacity-75 ltr:mr-auto rtl:ml-auto" href="{{ $logoLink }}">
2222
{{- if (.Site.Params.navbar.displayLogo | default true) }}
2323
<img class="block dark:hidden" src="{{ $logoPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />

layouts/shortcodes/card.html

+43-51
Original file line numberDiff line numberDiff line change
@@ -15,52 +15,38 @@
1515
{{- $options := .Get "options" | default "800x webp q80" -}}
1616

1717
{{- if and $image (not (urls.Parse $image).Scheme) -}}
18-
{{/* Process images in assets */}}
19-
{{- with resources.Get $image -}}
20-
{{- $processed := "" -}}
21-
{{- if eq $method "Resize" -}}
22-
{{- $processed = (.Resize $options) -}}
23-
{{- else if eq $method "Fit" -}}
24-
{{- $processed = (.Fit $options) -}}
25-
{{- else if eq $method "Fill" -}}
26-
{{- $processed = (.Fill $options) -}}
27-
{{- else if eq $method "Crop" -}}
28-
{{- $processed = (.Crop $options) -}}
29-
{{- else -}}
30-
{{- errorf "Invalid image processing command: Must be one of Crop, Fit, Fill or Resize." -}}
31-
{{- end -}}
32-
{{- $width = $processed.Width -}}
33-
{{- $height = $processed.Height -}}
34-
{{- $image = $processed.RelPermalink -}}
35-
{{- else -}}
36-
{{/* Otherwise, use relative link of the image */}}
37-
{{- if hasPrefix $image "/" -}}
38-
{{- $image = relURL (strings.TrimPrefix "/" $image) -}}
39-
{{- end -}}
40-
{{- end -}}
18+
{{/* Process images in assets */}}
19+
{{- with resources.Get $image -}}
20+
{{- $processed := "" -}}
21+
{{- if eq $method "Resize" -}}
22+
{{- $processed = (.Resize $options) -}}
23+
{{- else if eq $method "Fit" -}}
24+
{{- $processed = (.Fit $options) -}}
25+
{{- else if eq $method "Fill" -}}
26+
{{- $processed = (.Fill $options) -}}
27+
{{- else if eq $method "Crop" -}}
28+
{{- $processed = (.Crop $options) -}}
29+
{{- else -}}
30+
{{- errorf "Invalid image processing command: Must be one of Crop, Fit, Fill or Resize." -}}
31+
{{- end -}}
32+
{{- $width = $processed.Width -}}
33+
{{- $height = $processed.Height -}}
34+
{{- $image = $processed.RelPermalink -}}
35+
{{- else -}}
36+
{{/* Otherwise, use relative link of the image */}}
37+
{{- if hasPrefix $image "/" -}}
38+
{{- $image = relURL (strings.TrimPrefix "/" $image) -}}
39+
{{- end -}}
40+
{{- end -}}
4141
{{- end -}}
4242

4343
{{- $external := strings.HasPrefix $link "http" -}}
4444
{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}}
4545

4646
<div class="hextra-card group flex flex-col justify-start overflow-hidden rounded-lg border border-gray-200 text-current no-underline dark:shadow-none hover:shadow-lg dark:hover:shadow-none shadow-gray-100 active:shadow-sm active:shadow-gray-200 transition-all duration-200 bg-white">
47-
<a
48-
{{- if $link -}}
49-
href="{{ $href }}" {{ with $external }}target="_blank" rel="noreferrer"{{ end -}}
50-
{{- end -}}
51-
class="block"
52-
>
47+
<a {{- if $link -}} href="{{ $href }}" {{ with $external }}target="_blank" rel="noreferrer"{{ end -}} {{- end -}} class="block">
5348
{{- with $image -}}
54-
<img
55-
alt="{{ $title }}"
56-
loading="lazy"
57-
decoding="async"
58-
src="{{ $image | safeURL }}"
59-
{{ with $width }}width="{{ . }}"{{ end }}
60-
{{ with $height }}height="{{ . }}"{{ end }}
61-
{{ with $imageStyle }}style="{{ . | safeCSS }}"{{ end }}
62-
class="w-full object-cover h-48"
63-
/>
49+
<img alt="{{ $title }}" loading="lazy" decoding="async" src="{{ $image | safeURL }}" {{ with $width }}width="{{ . }}"{{ end }} {{ with $height }}height="{{ . }}"{{ end }} {{ with $imageStyle }}style="{{ . | safeCSS }}"{{ end }} class="w-full object-cover h-48" />
6450
{{- end -}}
6551

6652
<div class="p-4">
@@ -69,24 +55,30 @@
6955
{{- $title -}}
7056
</span>
7157
{{- with $subtitle -}}
72-
<div class="line-clamp-3 text-sm font-normal text-gray-500 dark:text-gray-400 mt-2">{{- $subtitle | markdownify -}}</div>
58+
<div class="line-clamp-3 text-sm font-normal text-gray-500 dark:text-gray-400 mt-2">{{- $subtitle | markdownify -}}</div>
7359
{{- end -}}
7460
</div>
7561
</a>
7662
{{- if $isGithubRepo -}}
77-
<div class="flex items-center justify-between px-4 py-3 border-t border-gray-200 dark:border-neutral-700">
78-
<div class="flex items-center">
63+
<div class="flex items-center justify-between px-4 py-3 border-t border-gray-200 dark:border-neutral-700">
64+
<div class="flex items-center">
65+
<svg class="h-4 w-4 text-gray-500 mr-1" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
66+
<path fill-rule="evenodd" d="M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z" clip-rule="evenodd" />
67+
</svg>
68+
<span class="text-sm text-gray-500">{{ $stars }}</span>
69+
</div>
70+
<a href="{{ $link }}" target="_blank" rel="noopener noreferrer" class="github-star-button inline-flex items-center px-3 py-1.5 border border-gray-300 shadow-sm text-xs font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
71+
<svg class="h-4 w-4 text-gray-500 mr-1" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
72+
<path d="M10 3.172l1.527 3.094 3.45.317L14.5 8.47l1.157 3.238-3.093-1.738L10 11.567l-1.564 2.343-3.093 1.738L5.5 8.47l-2.477-1.887 3.45-.317L10 3.172z" />
73+
</svg>
74+
<span>Star</span>
75+
</a>
76+
<a href="{{ $link }}" target="_blank" rel="noopener noreferrer" class="github-star-button inline-flex items-center px-3 py-1.5 border border-gray-300 shadow-sm text-xs font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
7977
<svg class="h-4 w-4 text-gray-500 mr-1" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
80-
<path fill-rule="evenodd" d="M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z" clip-rule="evenodd" />
78+
<path d="M12 2C6.477 2 2 6.477 2 12c0 4.42 2.87 8.17 6.84 9.5.5.08.68-.22.68-.48 0-.24-.01-.87-.01-1.7 0 0-2.78.58-3.37-1.38 0 0-.46-.96-1.14-1.22 0 0-.94-.01-.01-.01.88 0 1.6 1.02 1.6 1.02.94 1.58 2.44 1.1 3.03.84 0 0 .01-.65.01-1.18-2.33-.26-4.76-1.17-4.76-5.22 0-1.15.4-2.09 1.05-2.84-.11-.26-.46-1.34.1-2.79 0 0 .86-.28 2.81 1.07.82-.23 1.7-.34 2.58-.34.88 0 1.76.11 2.58.34 1.95-1.35 2.81-1.07 2.81-1.07.56 1.45.21 2.53.1 2.79.65.75 1.05 1.69 1.05 2.84 0 4.07-2.43 4.96-4.77 5.22.37.32.68.94.68 1.9 0 1.37-.01 2.48-.01 2.82 0 .26.18.56.68.48C19.13 20.17 22 16.42 22 12c0-5.523-4.477-10-10-10z" />
8179
</svg>
82-
<span class="text-sm text-gray-500">{{ $stars }}</span>
83-
</div>
84-
<a href="{{ $link }}" target="_blank" rel="noopener noreferrer" class="github-star-button inline-flex items-center px-3 py-1.5 border border-gray-300 shadow-sm text-xs font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
85-
<svg class="h-4 w-4 text-gray-500 mr-1" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
86-
<path d="M10 3.172l1.527 3.094 3.45.317L14.5 8.47l1.157 3.238-3.093-1.738L10 11.567l-1.564 2.343-3.093 1.738L5.5 8.47l-2.477-1.887 3.45-.317L10 3.172z" />
87-
</svg>
88-
<span>Star</span>
80+
<span>Github</span>
8981
</a>
90-
</div>
82+
</div>
9183
{{- end -}}
9284
</div>

layouts/shortcodes/grid-view.html

+66-29
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,90 @@
11
{{- $githubApiBase := "https://api.github.com/repos/" -}}
2+
{{- $cardsPerRow := .Get "cardsPerRow" | default 3 -}} {{/* Get the desired number of cards per row from shortcode parameters, default to 3 */}}
3+
{{- $cardsPerRowClass := "" -}}
4+
5+
{{- if eq $cardsPerRow 1 -}}
6+
{{- $cardsPerRowClass = "grid-cols-1" -}}
7+
{{- else if eq $cardsPerRow 2 -}}
8+
{{- $cardsPerRowClass = "grid-cols-1 md:grid-cols-2" -}}
9+
{{- else if eq $cardsPerRow 3 -}}
10+
{{- $cardsPerRowClass = "grid-cols-1 md:grid-cols-2 lg:grid-cols-3" -}}
11+
{{- else if eq $cardsPerRow 4 -}}
12+
{{- $cardsPerRowClass = "grid-cols-1 md:grid-cols-2 lg:grid-cols-4" -}}
13+
{{- else if eq $cardsPerRow 5 -}}
14+
{{- $cardsPerRowClass = "grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5" -}}
15+
{{- else -}}
16+
{{- $cardsPerRowClass = "grid-cols-1 md:grid-cols-2 lg:grid-cols-3" -}} {{/* Default to 3 if an invalid number is provided */}}
17+
{{- end -}}
18+
219
<div class="mb-8">
3-
<input type="text" id="categorySearch" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="Search by category...">
20+
<input type="text" id="categorySearch" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="Search by category or tool name...">
421
</div>
522
<div id="categoryGrid">
6-
{{- range $index, $categoryData := .Site.Data.tools }}
23+
{{- range $index, $categoryData := .Site.Data.tools }}
724
<h2 class="text-2xl font-bold mt-8 mb-4 category-title">{{ $categoryData.category }}</h2>
8-
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 category-grid">
9-
{{ range $index, $element := $categoryData.tools }}
10-
{{- $isGithubRepo := false -}}
11-
{{- $stars := 0 -}}
12-
{{- $repoPath := "" -}}
13-
14-
{{- if strings.Contains $element.url "github.com" -}}
15-
{{- $isGithubRepo = true -}}
16-
{{- $repoPath = replace $element.url "https://github.com/" "" -}}
17-
{{- if strings.Contains $repoPath "/" -}}
18-
{{- $apiURL := printf "%s%s" $githubApiBase $repoPath -}}
19-
{{- $tryResponse := try (resources.GetRemote $apiURL) -}}
20-
{{- if $tryResponse -}}
21-
{{- $response := $tryResponse.Value -}}
22-
{{- if eq $response.MediaType.SubType "json" -}}
23-
{{- $jsonData := $response | transform.Unmarshal -}}
24-
{{- $stars = $jsonData.stargazers_count -}}
25-
{{- end -}}
26-
{{- end -}}
27-
{{- else -}}
28-
{{- $isGithubRepo = false -}}
29-
{{- end -}}
30-
{{- end -}}
31-
32-
{{- $cardParams := dict "link" $element.url "title" $element.name "subtitle" $element.description "isGithubRepo" $isGithubRepo "stars" $stars -}}
33-
{{- partial "shortcodes/card.html" $cardParams -}}
25+
<div class="grid {{ $cardsPerRowClass }} gap-6 category-grid">
26+
{{ range $index, $tool := $categoryData.tools }}
27+
{{- $isGithubRepo := false -}}
28+
{{- $stars := 0 -}}
29+
{{- $repoPath := "" -}}
30+
31+
{{- if strings.Contains $tool.url "github.com" -}}
32+
{{- $isGithubRepo = true -}}
33+
{{- $repoPath = replace $tool.url "https://github.com/" "" -}}
34+
{{- if strings.Contains $repoPath "/" -}}
35+
{{- $apiURL := printf "%s%s" $githubApiBase $repoPath -}}
36+
{{- $tryResponse := try (resources.GetRemote $apiURL) -}}
37+
{{- if $tryResponse -}}
38+
{{- $response := $tryResponse.Value -}}
39+
{{- if eq $response.MediaType.SubType "json" -}}
40+
{{- $jsonData := $response | transform.Unmarshal -}}
41+
{{- $stars = $jsonData.stargazers_count -}}
42+
{{- end -}}
43+
{{- end -}}
44+
{{- else -}}
45+
{{- $isGithubRepo = false -}}
46+
{{- end -}}
47+
{{- end -}}
48+
49+
{{- $cardParams := dict "link" $tool.url "title" $tool.name "subtitle" $tool.description "isGithubRepo" $isGithubRepo "stars" $stars -}}
50+
{{- partial "shortcodes/card.html" $cardParams -}}
3451
{{ end }}
3552
</div>
36-
{{ end }}
53+
{{ end }}
3754
</div>
3855
<script>
3956
const searchInput = document.getElementById('categorySearch');
4057
const categoryTitles = document.querySelectorAll('.category-title');
4158
const categoryGrids = document.querySelectorAll('.category-grid');
59+
const cards = document.querySelectorAll('.hextra-card');
4260

4361
searchInput.addEventListener('input', () => {
4462
const searchTerm = searchInput.value.toLowerCase();
4563

4664
categoryTitles.forEach((title, index) => {
4765
const categoryName = title.textContent.toLowerCase();
4866
const grid = categoryGrids[index];
67+
let categoryVisible = false;
4968

69+
// Check if the category name matches the search term
5070
if (categoryName.includes(searchTerm)) {
71+
categoryVisible = true;
72+
}
73+
74+
// Check if any card in the category matches the search term
75+
const categoryCards = grid.querySelectorAll('.hextra-card');
76+
categoryCards.forEach(card => {
77+
const cardTitle = card.querySelector('.font-semibold').textContent.toLowerCase();
78+
if (cardTitle.includes(searchTerm)) {
79+
categoryVisible = true;
80+
card.style.display = 'block';
81+
} else {
82+
card.style.display = 'none';
83+
}
84+
});
85+
86+
// Show/hide the category based on visibility
87+
if (categoryVisible) {
5188
title.style.display = 'block';
5289
grid.style.display = 'grid';
5390
} else {

0 commit comments

Comments
 (0)