From 137c4816d69de63bf8f7e54d9279c208e8dae7f4 Mon Sep 17 00:00:00 2001 From: Misode Date: Wed, 18 Sep 2024 14:45:50 +0200 Subject: [PATCH] Allow generators to be listed in two columns --- src/app/components/generator/GeneratorCard.tsx | 6 +++--- src/app/components/generator/GeneratorList.tsx | 2 +- src/styles/global.css | 18 ++++++++++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/app/components/generator/GeneratorCard.tsx b/src/app/components/generator/GeneratorCard.tsx index 5d9e1cfd..0ddc039a 100644 --- a/src/app/components/generator/GeneratorCard.tsx +++ b/src/app/components/generator/GeneratorCard.tsx @@ -1,10 +1,10 @@ import { useMemo } from 'preact/hooks' import type { ConfigGenerator } from '../../Config.js' import config from '../../Config.js' -import { cleanUrl } from '../../Utils.js' import { useLocale } from '../../contexts/Locale.jsx' import type { VersionId } from '../../services/Schemas.js' import { checkVersion } from '../../services/Schemas.js' +import { cleanUrl } from '../../Utils.js' import { Badge, Card, Icons, ToolCard } from '../index.js' const VERSION_SEP = ' • ' @@ -40,12 +40,12 @@ export function GeneratorCard({ id, minimal }: Props) { }, [gen]) const versionText = useMemo(() => { - if (versions.length <= 5) { + if (versions.length <= 3) { return versions.join(VERSION_SEP) } return versions[0] + VERSION_SEP + '...' + VERSION_SEP - + versions.slice(-3).join(VERSION_SEP) + + versions.slice(-2).join(VERSION_SEP) }, [versions]) const tags = useMemo(() => { diff --git a/src/app/components/generator/GeneratorList.tsx b/src/app/components/generator/GeneratorList.tsx index 38788c84..7faf0cb9 100644 --- a/src/app/components/generator/GeneratorList.tsx +++ b/src/app/components/generator/GeneratorList.tsx @@ -45,7 +45,7 @@ export function GeneratorList({ predicate }: Props) { {filteredGenerators.length === 0 ? <> {locale('generators.no_results')} - :
+ :
{filteredGenerators.map(gen => )} diff --git a/src/styles/global.css b/src/styles/global.css index 55e4123a..6f519b17 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -2291,6 +2291,7 @@ hr { .navigation + .card-column, .badges-list + .card-column, +.navigation + .card-grid, .navigation + .badges-list { margin-top: 8px; } @@ -2681,6 +2682,18 @@ hr { margin-bottom: 8px; } +.card-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 8px; +} + +@media screen and (max-width: 980px) { + .card-grid { + grid-template-columns: 1fr; + } +} + .card { display: block; text-decoration: none; @@ -2714,11 +2727,12 @@ hr { color: var(--text-2); fill: currentColor; margin-left: 8px; - transition: margin 0.2s; + margin-right: 8px; + transition: transform 0.2s; } .card:hover .card-title svg { - margin-left: 14px; + transform: translateX(6px); } .card-overlay {