diff --git a/src/app/components/GuideCard.tsx b/src/app/components/GuideCard.tsx index 4eaf0010..2428406e 100644 --- a/src/app/components/GuideCard.tsx +++ b/src/app/components/GuideCard.tsx @@ -5,10 +5,11 @@ import { Badge } from './index.js' interface Props { id: string, + minimal?: boolean, activeTags?: string[], toggleTag?: (tag: string) => unknown, } -export function GuideCard({ id, activeTags, toggleTag }: Props) { +export function GuideCard({ id, minimal, activeTags, toggleTag }: Props) { const { title, versions, tags } = useMemo(() => getGuide(id), [id]) const onToggleTag = (tag: string) => (e: MouseEvent) => { @@ -17,7 +18,7 @@ export function GuideCard({ id, activeTags, toggleTag }: Props) { e.stopImmediatePropagation() } - return + return
{tags?.sort().map(tag => )}
diff --git a/src/app/pages/Home.tsx b/src/app/pages/Home.tsx index 95d806f7..6337bb74 100644 --- a/src/app/pages/Home.tsx +++ b/src/app/pages/Home.tsx @@ -2,6 +2,7 @@ import { useMemo } from 'preact/hooks' import { ChangelogEntry, Footer, GeneratorCard, Giscus, GuideCard, ToolCard, ToolGroup } from '../components/index.js' import { useLocale, useTitle } from '../contexts/index.js' import { useAsync } from '../hooks/useAsync.js' +import { useMediaQuery } from '../hooks/useMediaQuery.js' import { fetchChangelogs, fetchVersions } from '../services/DataFetcher.js' import { Store } from '../Store.js' @@ -15,6 +16,45 @@ export function Home({}: Props) { const { locale } = useLocale() useTitle(locale('title.home')) + const smallScreen = useMediaQuery('(max-width: 580px)') + + return
+
+
+
+ + {smallScreen && } + + {smallScreen && } + + {smallScreen && } +
+ {!smallScreen &&
+ + + +
} +
+ +
+
+
+} + +function PopularGenerators() { + const { locale } = useLocale() + return + + + + + + +} + +function FavoriteGenerators() { + const { locale } = useLocale() + const favorites = useMemo(() => { const history: string[] = [] for (const id of Store.getGeneratorHistory().reverse()) { @@ -25,54 +65,61 @@ export function Home({}: Props) { return history.slice(0, MAX_FAVORITES) }, []) + if (favorites.length < MIN_FAVORITES) return <> + + return + {favorites.map(f => )} + +} + +function Guides() { + const { locale } = useLocale() + + return + + + +} + +function Tools() { + const { locale } = useLocale() + + return + + + + +} + +function Versions() { + const { locale } = useLocale() + const { value: versions } = useAsync(fetchVersions, []) const release = useMemo(() => versions?.find(v => v.type === 'release'), [versions]) + return + {(versions?.[0] && release) && <> + {versions[0].id !== release.id && ( + + )} + + } + +} + +function Changelog() { + const { locale } = useLocale() + const { value: changes } = useAsync(fetchChangelogs, []) const latestChanges = useMemo(() => changes?.sort((a, b) => b.order - a.order).slice(0, 2), [changes]) - return
-
-
- - - - - - - - {favorites.length >= MIN_FAVORITES && - {favorites.map(f => )} - } - - - - - - - - - - - {(versions?.[0] && release) && <> - {versions[0].id !== release.id && ( - - )} - - } - - - {latestChanges?.map(change => )} - -
- -
-
-
+ return + {latestChanges?.map(change => )} + } diff --git a/src/app/pages/Worldgen.tsx b/src/app/pages/Worldgen.tsx index ea64e3d5..c5c01fb0 100644 --- a/src/app/pages/Worldgen.tsx +++ b/src/app/pages/Worldgen.tsx @@ -11,7 +11,7 @@ export function Worldgen({}: Props) { return
- + diff --git a/src/styles/global.css b/src/styles/global.css index 6c5cdf5d..cc95acc2 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -1571,6 +1571,7 @@ hr { .badges-list { display: flex; flex-wrap: wrap; + gap: 8px 0; } .changelog-version { @@ -1816,6 +1817,15 @@ hr { align-items: flex-start; } +.card-column { + display: flex; + flex-direction: column; +} + +.card-column > *:not(:last-child) { + margin-bottom: 8px; +} + .card { display: block; text-decoration: none; @@ -2135,6 +2145,10 @@ hr { grid-template-columns: 1fr; } + .card-columns { + grid-template-columns: 1fr; + } + .title h1 { font-size: 18px; }