From 02695bc22c1e4bfcd3bced4808474af5b3d2a9ad Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Mon, 22 Jul 2024 12:35:55 +0200 Subject: [PATCH] feat: :sparkles: Make branding adapt to our colors --- components/Button.tsx | 6 +++--- components/Code.tsx | 6 +++--- components/Feedback.tsx | 4 ++-- components/HeroPattern.tsx | 2 +- components/Logo.tsx | 2 +- components/Navigation.tsx | 2 +- components/Resources.tsx | 6 +++--- components/Search.tsx | 6 +++--- components/Tag.tsx | 10 +++++----- components/mdx.tsx | 4 ++-- styles/tailwind.css | 6 +++--- tailwind.config.ts | 5 +++++ typography.ts | 12 ++++++------ 13 files changed, 38 insertions(+), 33 deletions(-) diff --git a/components/Button.tsx b/components/Button.tsx index 88526e8..7532a4e 100644 --- a/components/Button.tsx +++ b/components/Button.tsx @@ -17,13 +17,13 @@ function ArrowIcon(props: ComponentPropsWithoutRef<"svg">) { const variantStyles = { primary: - "rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-emerald-400/10 dark:text-emerald-400 dark:ring-1 dark:ring-inset dark:ring-emerald-400/20 dark:hover:bg-emerald-400/10 dark:hover:text-emerald-300 dark:hover:ring-emerald-300", + "rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-brand-400/10 dark:text-brand-400 dark:ring-1 dark:ring-inset dark:ring-brand-400/20 dark:hover:bg-brand-400/10 dark:hover:text-brand-300 dark:hover:ring-brand-300", secondary: "rounded-full bg-zinc-100 py-1 px-3 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800/40 dark:text-zinc-400 dark:ring-1 dark:ring-inset dark:ring-zinc-800 dark:hover:bg-zinc-800 dark:hover:text-zinc-300", - filled: "rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-emerald-500 dark:text-white dark:hover:bg-emerald-400", + filled: "rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-brand-500 dark:text-white dark:hover:bg-brand-400", outline: "rounded-full py-1 px-3 text-zinc-700 ring-1 ring-inset ring-zinc-900/10 hover:bg-zinc-900/2.5 hover:text-zinc-900 dark:text-zinc-400 dark:ring-white/10 dark:hover:bg-white/5 dark:hover:text-white", - text: "text-emerald-500 hover:text-emerald-600 dark:text-emerald-400 dark:hover:text-emerald-500", + text: "text-brand-500 hover:text-brand-600 dark:text-brand-400 dark:hover:text-brand-500", }; type ButtonProps = { diff --git a/components/Code.tsx b/components/Code.tsx index 680776b..f70d73c 100644 --- a/components/Code.tsx +++ b/components/Code.tsx @@ -79,7 +79,7 @@ function CopyButton({ code }: { code: string }) { className={clsx( "group/button absolute right-4 top-3.5 overflow-hidden rounded-full py-1 pl-2 pr-3 text-2xs font-medium opacity-0 backdrop-blur transition focus:opacity-100 group-hover:opacity-100", copied - ? "bg-emerald-400/10 ring-1 ring-inset ring-emerald-400/20" + ? "bg-brand-400/10 ring-1 ring-inset ring-brand-400/20" : "bg-white/5 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5", )} onClick={() => { @@ -101,7 +101,7 @@ function CopyButton({ code }: { code: string }) { @@ -200,7 +200,7 @@ function CodeGroupHeader({ className={clsx( "border-b py-3 transition ui-not-focus-visible:outline-none", childIndex === selectedIndex - ? "border-emerald-500 text-emerald-400" + ? "border-brand-500 text-brand-400" : "border-transparent text-zinc-400 hover:text-zinc-300", )} > diff --git a/components/Feedback.tsx b/components/Feedback.tsx index 0e65c40..a8b509d 100644 --- a/components/Feedback.tsx +++ b/components/Feedback.tsx @@ -66,8 +66,8 @@ const FeedbackThanks = forwardRef>( ref={ref} className="absolute inset-0 flex justify-center md:justify-start" > -
- +
+ Thanks for your feedback!
diff --git a/components/HeroPattern.tsx b/components/HeroPattern.tsx index b81ff81..7f4de25 100644 --- a/components/HeroPattern.tsx +++ b/components/HeroPattern.tsx @@ -4,7 +4,7 @@ export function HeroPattern() { return (
-
+
) { return (
+
); } @@ -118,7 +118,7 @@ function ResourcePattern({ />
) { function HighlightQuery({ text, query }: { text: string; query: string }) { return (
@@ -321,7 +321,7 @@ const SearchInput = forwardRef< /> {autocompleteState.status === "stalled" && (
- +
)}
diff --git a/components/Tag.tsx b/components/Tag.tsx index c83859a..a4b6d99 100644 --- a/components/Tag.tsx +++ b/components/Tag.tsx @@ -6,9 +6,9 @@ const variantStyles = { }; const colorStyles = { - emerald: { - small: "text-emerald-500 dark:text-emerald-400", - medium: "ring-emerald-300 dark:ring-emerald-400/30 bg-emerald-400/10 text-emerald-500 dark:text-emerald-400", + brand: { + small: "text-brand-500 dark:text-brand-400", + medium: "ring-brand-300 dark:ring-brand-400/30 bg-brand-400/10 text-brand-500 dark:text-brand-400", }, sky: { small: "text-sky-500", @@ -29,7 +29,7 @@ const colorStyles = { }; const valueColorMap = { - GET: "emerald", + GET: "brand", POST: "sky", PUT: "amber", DELETE: "rose", @@ -38,7 +38,7 @@ const valueColorMap = { export function Tag({ children, variant = "medium", - color = valueColorMap[children] ?? "emerald", + color = valueColorMap[children] ?? "brand", }: { children: keyof typeof valueColorMap; variant?: keyof typeof variantStyles; diff --git a/components/mdx.tsx b/components/mdx.tsx index cdac80e..5bbd3d3 100644 --- a/components/mdx.tsx +++ b/components/mdx.tsx @@ -46,8 +46,8 @@ function InfoIcon(props: ComponentPropsWithoutRef<"svg">) { export function Note({ children }: { children: ReactNode }) { return ( -
- +
+
{children}
diff --git a/styles/tailwind.css b/styles/tailwind.css index 6673210..bfc9612 100644 --- a/styles/tailwind.css +++ b/styles/tailwind.css @@ -1,13 +1,13 @@ @layer base { :root { --shiki-color-text: theme('colors.white'); - --shiki-token-constant: theme('colors.emerald.300'); - --shiki-token-string: theme('colors.emerald.300'); + --shiki-token-constant: theme('colors.brand.300'); + --shiki-token-string: theme('colors.brand.300'); --shiki-token-comment: theme('colors.zinc.500'); --shiki-token-keyword: theme('colors.sky.300'); --shiki-token-parameter: theme('colors.pink.300'); --shiki-token-function: theme('colors.violet.300'); - --shiki-token-string-expression: theme('colors.emerald.300'); + --shiki-token-string-expression: theme('colors.brand.300'); --shiki-token-punctuation: theme('colors.zinc.200'); } diff --git a/tailwind.config.ts b/tailwind.config.ts index 4cca0b4..3a1a20a 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,6 +1,7 @@ import headlessuiPlugin from "@headlessui/tailwindcss"; import typographyPlugin from "@tailwindcss/typography"; import type { Config } from "tailwindcss"; +import colors from "tailwindcss/colors"; import typographyStyles from "./typography"; @@ -33,6 +34,10 @@ export default { boxShadow: { glow: "0 0 4px rgb(0 0 0 / 0.1)", }, + colors: { + brand: colors.pink, + secondary: colors.purple, + }, maxWidth: { lg: "33rem", "2xl": "40rem", diff --git a/typography.ts b/typography.ts index 1d535bc..0df1175 100644 --- a/typography.ts +++ b/typography.ts @@ -6,9 +6,9 @@ export default function typographyStyles({ theme }: PluginUtils) { css: { "--tw-prose-body": theme("colors.zinc.700"), "--tw-prose-headings": theme("colors.zinc.900"), - "--tw-prose-links": theme("colors.emerald.500"), - "--tw-prose-links-hover": theme("colors.emerald.600"), - "--tw-prose-links-underline": theme("colors.emerald.500 / 0.3"), + "--tw-prose-links": theme("colors.brand.500"), + "--tw-prose-links-hover": theme("colors.brand.600"), + "--tw-prose-links-underline": theme("colors.brand.500 / 0.3"), "--tw-prose-bold": theme("colors.zinc.900"), "--tw-prose-counters": theme("colors.zinc.500"), "--tw-prose-bullets": theme("colors.zinc.300"), @@ -24,10 +24,10 @@ export default function typographyStyles({ theme }: PluginUtils) { "--tw-prose-invert-body": theme("colors.zinc.400"), "--tw-prose-invert-headings": theme("colors.white"), - "--tw-prose-invert-links": theme("colors.emerald.400"), - "--tw-prose-invert-links-hover": theme("colors.emerald.500"), + "--tw-prose-invert-links": theme("colors.brand.400"), + "--tw-prose-invert-links-hover": theme("colors.brand.500"), "--tw-prose-invert-links-underline": theme( - "colors.emerald.500 / 0.3", + "colors.brand.500 / 0.3", ), "--tw-prose-invert-bold": theme("colors.white"), "--tw-prose-invert-counters": theme("colors.zinc.400"),