From f67da3f7a10a7e1ecff89b00dfd7659240ce739f Mon Sep 17 00:00:00 2001 From: Misode Date: Sat, 6 Nov 2021 01:06:33 +0100 Subject: [PATCH] Improve home page with separate data and resource pack cards --- src/app/components/Header.tsx | 2 +- src/app/components/ToolCard.tsx | 25 +++++++---- src/app/pages/Category.tsx | 2 +- src/app/pages/Home.tsx | 33 ++++++++------ src/styles/global.css | 79 ++++++++++++++++++++++----------- 5 files changed, 90 insertions(+), 51 deletions(-) diff --git a/src/app/components/Header.tsx b/src/app/components/Header.tsx index 4e3f236b..67f318b8 100644 --- a/src/app/components/Header.tsx +++ b/src/app/components/Header.tsx @@ -28,7 +28,7 @@ export function Header({ lang, title, version, theme, changeTheme, language, cha return
{Icons.home} -

{title}

+

{title}

{gen && {config.generators .filter(g => g.category === gen?.category && checkVersion(version, g.minVersion)) diff --git a/src/app/components/ToolCard.tsx b/src/app/components/ToolCard.tsx index bdbd924a..7c338ef3 100644 --- a/src/app/components/ToolCard.tsx +++ b/src/app/components/ToolCard.tsx @@ -3,16 +3,25 @@ import { Icons } from './Icons' type ToolCardProps = { title: string, - link: string, + desc?: string, + link?: string, icon?: keyof typeof Icons, children?: ComponentChildren, } -export function ToolCard({ title, link, icon, children }: ToolCardProps) { - return - {icon && Icons[icon]} -
-

{title}

- {children} +export function ToolCard({ title, desc, link, icon, children }: ToolCardProps) { + const content = <> +
+ {icon && Icons[icon]} +
+

{title}

+

{desc}

+
-
+ {children &&
+ {children} +
} + + return link + ? {content} + :
{content}
} diff --git a/src/app/pages/Category.tsx b/src/app/pages/Category.tsx index 5ad6192c..761dd43c 100644 --- a/src/app/pages/Category.tsx +++ b/src/app/pages/Category.tsx @@ -13,7 +13,7 @@ export function Category({ category, lang, changeTitle }: WorldgenProps) { const loc = locale.bind(null, lang) changeTitle(loc('title.generator_category', loc(category))) return
-
+
{config.generators.filter(g => g.category === category).map(g => )} diff --git a/src/app/pages/Home.tsx b/src/app/pages/Home.tsx index a928b302..f7ea1e1b 100644 --- a/src/app/pages/Home.tsx +++ b/src/app/pages/Home.tsx @@ -11,24 +11,29 @@ type HomeProps = { export function Home({ lang, changeTitle }: HomeProps) { const loc = locale.bind(null, lang) changeTitle(loc('title.home')) + console.log(config.generators) return
- {config.generators.filter(g => !g.category).map(g => - - )} - -
- -
- -

Analyse your performance reports

+ + {config.generators.filter(g => !g.category).map(g => + + )} + - -

Browse through and mix all the vanilla sounds

-
- -

Convert your 1.16 data packs to 1.17

+ + {config.generators.filter(g => g.category === 'assets').map(g => + + )} + + +
diff --git a/src/styles/global.css b/src/styles/global.css index a2dcd4cd..d1adc0a8 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -129,7 +129,8 @@ body[data-panel="settings"] header { align-items: center; } -.title h2 { +.title h1 { + font-size: 27px; color: var(--nav); } @@ -648,34 +649,31 @@ main.has-preview { color: var(--text-1) } -.home { +.home, .category { padding: 16px; -} - -.generator-picker { - display: flex; -} - -.home.center { - flex-direction: column; - align-items: center; - color: var(--nav); -} - -.home.center p { - padding-bottom: 20px; - text-align: center; - font-size: 20px; -} - -.home { max-width: 960px; margin: 0 auto; } +.home { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 0 8px; + align-items: flex-start; +} + +.home > *:nth-child(n+3) { + grid-column: 1 / 3; +} + +h2 { + font-size: 24px; + font-weight: unset; +} + .tool-card { display: flex; - padding: 10px; + flex-direction: column; margin-bottom: 8px; color: var(--text-2); background-color: var(--background-2); @@ -684,25 +682,43 @@ main.has-preview { text-decoration: none; } -.tool-card:hover { +a.tool-card:hover { background-color: var(--background-3); } -.tool-card svg { +.tool-head { + display: flex; + padding: 10px; +} + +.tool-head svg { width: 32px; height: 32px; flex-shrink: 0; margin-right: 8px; } -.tool-card h3 { +.tool-head h3 { font-weight: unset; } -.tool-card p { +.tool-head p { color: var(--text-3); } +.tool-body { + display: flex; + flex-direction: column; + border-top: 2px solid var(--background-1); + padding-top: 4px; +} + +.tool-body > .tool-card { + margin: 0 8px 8px; + box-shadow: none; + margin-bottom: 0; +} + hr { margin: 12px 0; border: none; @@ -1193,7 +1209,16 @@ hr { /* SMALL */ @media screen and (max-width: 580px) { - .title h2 { + .home { + grid-template-columns: 1fr; + gap: 0; + } + + .home > * { + grid-column: 1 / 2; + } + + .title h1 { font-size: 18px; }