Skip to content

Commit 137c481

Browse files
committed
Allow generators to be listed in two columns
1 parent d7781d7 commit 137c481

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

src/app/components/generator/GeneratorCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { useMemo } from 'preact/hooks'
22
import type { ConfigGenerator } from '../../Config.js'
33
import config from '../../Config.js'
4-
import { cleanUrl } from '../../Utils.js'
54
import { useLocale } from '../../contexts/Locale.jsx'
65
import type { VersionId } from '../../services/Schemas.js'
76
import { checkVersion } from '../../services/Schemas.js'
7+
import { cleanUrl } from '../../Utils.js'
88
import { Badge, Card, Icons, ToolCard } from '../index.js'
99

1010
const VERSION_SEP = ' • '
@@ -40,12 +40,12 @@ export function GeneratorCard({ id, minimal }: Props) {
4040
}, [gen])
4141

4242
const versionText = useMemo(() => {
43-
if (versions.length <= 5) {
43+
if (versions.length <= 3) {
4444
return versions.join(VERSION_SEP)
4545
}
4646
return versions[0] + VERSION_SEP
4747
+ '...' + VERSION_SEP
48-
+ versions.slice(-3).join(VERSION_SEP)
48+
+ versions.slice(-2).join(VERSION_SEP)
4949
}, [versions])
5050

5151
const tags = useMemo(() => {

src/app/components/generator/GeneratorList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function GeneratorList({ predicate }: Props) {
4545
</div>
4646
{filteredGenerators.length === 0 ? <>
4747
<span class="note">{locale('generators.no_results')}</span>
48-
</> : <div class="card-column">
48+
</> : <div class="card-grid">
4949
{filteredGenerators.map(gen =>
5050
<GeneratorCard id={gen.id} />
5151
)}

src/styles/global.css

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,6 +2291,7 @@ hr {
22912291

22922292
.navigation + .card-column,
22932293
.badges-list + .card-column,
2294+
.navigation + .card-grid,
22942295
.navigation + .badges-list {
22952296
margin-top: 8px;
22962297
}
@@ -2681,6 +2682,18 @@ hr {
26812682
margin-bottom: 8px;
26822683
}
26832684

2685+
.card-grid {
2686+
display: grid;
2687+
grid-template-columns: 1fr 1fr;
2688+
gap: 8px;
2689+
}
2690+
2691+
@media screen and (max-width: 980px) {
2692+
.card-grid {
2693+
grid-template-columns: 1fr;
2694+
}
2695+
}
2696+
26842697
.card {
26852698
display: block;
26862699
text-decoration: none;
@@ -2714,11 +2727,12 @@ hr {
27142727
color: var(--text-2);
27152728
fill: currentColor;
27162729
margin-left: 8px;
2717-
transition: margin 0.2s;
2730+
margin-right: 8px;
2731+
transition: transform 0.2s;
27182732
}
27192733

27202734
.card:hover .card-title svg {
2721-
margin-left: 14px;
2735+
transform: translateX(6px);
27222736
}
27232737

27242738
.card-overlay {

0 commit comments

Comments
 (0)