From aa9c6a65aa4db7da53fd054ca0aeaec3d6344514 Mon Sep 17 00:00:00 2001 From: Amio Date: Thu, 22 Jun 2023 15:34:14 +0800 Subject: [PATCH] feat: add colors, icons, and generator links to help --- components/{home-intro.tsx => help-info.tsx} | 30 ++++++++++++++++---- libs/badge-list2.ts | 2 +- pages/help.tsx | 8 ++++-- 3 files changed, 31 insertions(+), 9 deletions(-) rename components/{home-intro.tsx => help-info.tsx} (84%) diff --git a/components/home-intro.tsx b/components/help-info.tsx similarity index 84% rename from components/home-intro.tsx rename to components/help-info.tsx index cebce1f..fa90e7c 100644 --- a/components/home-intro.tsx +++ b/components/help-info.tsx @@ -1,12 +1,14 @@ +/* eslint-disable @next/next/no-img-element */ import icons from 'badgen-icons' import Image from 'next/image' +import BadgeList from '../public/.meta/badge-list.json' // import { Open_Sans } from '@next/font/google' // const openSans = Open_Sans({ subsets: ['latin'], weight: ['400'] }) export default function HomeIntro ({ isFlat = false }) { return ( -
+
{explainCode(isFlat)}

Options

@@ -48,6 +50,20 @@ export default function HomeIntro ({ isFlat = false }) { +

Builtin Colors

+ { colorExamples() } + +

Builtin Icons

+ { iconExamples() } + +

Badge Generators

+ { + Object.keys(BadgeList).map(badge => { + const href = '/' + badge + return {href} + }) + } +

Advanced usage

  • @@ -59,6 +75,7 @@ export default function HomeIntro ({ isFlat = false }) { turn an api endpoint into a svg live badge.
+ @@ -90,7 +108,7 @@ const colorExamples = () => { const colors = ['blue', 'cyan', 'green', 'yellow', 'orange', 'red', 'pink', 'purple', 'grey', 'black'] return colors.map(c => ( - {c} + {c} // eslint-disable-line } + +function ColorBadge ({color: string}) { + return blue +}