update /www and tailwind-plugin to support tailwind v4. Thanks to the merge of #3034, the work of integrating and advancing #2903 is promoted. related #3034 related #2903 close #3056 close #2819 --patch-1 based on review, 1. del compiler and make it more clean and simple, 2. fix init tailwind part, 3. fix test tailwind part --patch-2 1. fix the docs 2. fix the docs of plugin and version --patch-3 1. Addressed various maintenance tasks (chores) 2. Updated the Tailwind CSS plugin to align with this release. Generated a fresh project using the updated init configuration and 3. deployed it via Deno Deploy EA. Deployment is functioning correctly. --patch-4 Move postcss imports to Tailwind section in init script --patch-5 Refactored Tailwind plugin type definitions by copying PluginOptions properties from @tailwindcss/postcss and adding Fresh-specific exclude option, while exporting types from package entrypoint for better accessibility. Test Project: https://fresh.fresh-press.deno.net/ Test Project Repository: https://github.com/SisyphusZheng/fresh-tailwindv4 Test Plugin: https://jsr.io/@freshpress/fresh-plugin-tailwind@1.0.0 --------- Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com> Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com> Co-authored-by: Marvin Hagemeister <marvin@deno.com>
63 lines
2.2 KiB
TypeScript
63 lines
2.2 KiB
TypeScript
// Copyright 2022-2023 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import { IS_BROWSER } from "fresh/runtime";
|
|
import type { VersionLink } from "../routes/docs/[...slug].tsx";
|
|
|
|
export default function VersionSelect(
|
|
{ versions, selectedVersion }: {
|
|
versions: VersionLink[];
|
|
selectedVersion: string;
|
|
},
|
|
) {
|
|
const selectedIsLatest = selectedVersion === "latest";
|
|
const selectedIsCanary = selectedVersion === "canary";
|
|
|
|
return (
|
|
<>
|
|
<div class="relative mr-4 sm:mr-0">
|
|
<label htmlFor="version" class="sr-only">
|
|
Version
|
|
</label>
|
|
{selectedIsLatest && (
|
|
<div class="flex absolute pointer-events-none select-none w-full h-full items-center justify-end pr-8">
|
|
<div class="rounded-full px-2 py-1 text-xs tag-label bg-[#056CF025] dark:bg-[#2182ff45] text-blue-700 dark:text-blue-400">
|
|
Latest
|
|
</div>
|
|
</div>
|
|
)}
|
|
{selectedIsCanary && (
|
|
<div class="flex absolute pointer-events-none select-none w-full h-full items-center justify-end pr-8">
|
|
<div class="rounded-full px-2 py-1 text-xs tag-label bg-[#F0900525] text-yellow-600">
|
|
🚧 Preview
|
|
</div>
|
|
</div>
|
|
)}
|
|
<select
|
|
id="version"
|
|
class={`rounded-md block border border-foreground-primary/20 appearance-none bg-background-primary form-select-bg font-semibold ${
|
|
selectedIsLatest ? "pr-22" : "pr-10"
|
|
} py-2 pl-3 w-full h-full leading-none sm:text-sm sm:leading-5 focus:outline-hidden focus:border-blue-300 hover:bg-background-secondary`}
|
|
value={selectedVersion}
|
|
onChange={(e) => {
|
|
if (e.currentTarget.value !== selectedVersion) {
|
|
const entry = versions.find((entry) =>
|
|
entry.value === e.currentTarget.value
|
|
);
|
|
if (entry) {
|
|
location.href = entry.href;
|
|
}
|
|
}
|
|
}}
|
|
disabled={!IS_BROWSER}
|
|
>
|
|
{versions.map((entry) => (
|
|
<option key={entry.value} value={entry.value}>
|
|
{entry.label}
|
|
</option>
|
|
))}
|
|
</select>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|