Skip to content

Commit cbc5ce5

Browse files
committed
dynamically compute Tailwind CSS version based on tailwindcss package
Only use the {major}.{minor} version
1 parent 412c7e7 commit cbc5ce5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/components/header.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { useRouter } from "next/navigation";
77
import { useState } from "react";
88
import { IconButton } from "./icon-button";
99
import { SearchButton } from "./search";
10+
import { version } from "tailwindcss/package.json";
11+
12+
const TAILWINDCSS_VERSION = version.split(".").slice(0, 2).join(".");
1013

1114
function Logo(props: React.ComponentProps<"svg">) {
1215
return (
@@ -54,7 +57,7 @@ function VersionPicker() {
5457
className="flex items-center gap-0.5 rounded-2xl bg-gray-950/5 py-0.5 pr-1.5 pl-2.5 text-xs/5 font-medium text-gray-950 tabular-nums hover:bg-gray-950/7.5 data-active:bg-gray-950/7.5 dark:bg-white/10 dark:text-white dark:hover:bg-white/12.5 dark:data-active:bg-white/12.5"
5558
aria-label="Select version of library"
5659
>
57-
v4.2
60+
v{TAILWINDCSS_VERSION}
5861
<ChevronDownIcon className="size-4 fill-gray-400" />
5962
</MenuButton>
6063
<MenuItems
@@ -63,7 +66,7 @@ function VersionPicker() {
6366
>
6467
<MenuItem disabled>
6568
<div className="flex items-center justify-between gap-2 rounded-lg px-2.5 data-active:bg-gray-950/5 dark:data-active:bg-white/10">
66-
v4.2
69+
v{TAILWINDCSS_VERSION}
6770
<CheckIcon className="size-4" />
6871
</div>
6972
</MenuItem>

0 commit comments

Comments
 (0)