Files
sweet/www/components/SideBySide.tsx
T
bb23643779 feat: support tailwindcss v4 (#3054)
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>
2025-07-21 16:13:34 +02:00

37 lines
1.1 KiB
TypeScript

import type { JSX } from "preact/jsx-runtime";
type ColumnConfiguration = "1/1" | "2/3" | "3/2";
interface SideBySideProps extends JSX.HTMLAttributes<HTMLDivElement> {
mdColSplit?: ColumnConfiguration;
lgColSplit?: ColumnConfiguration;
reverseOnDesktop?: boolean;
}
export function SideBySide(props: SideBySideProps) {
let mdSplitClass = "md:grid-cols-2";
let lgSplitClass = "lg:grid-cols-2";
if (props.mdColSplit === "2/3") {
mdSplitClass = "md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]";
} else if (props.mdColSplit === "3/2") {
mdSplitClass = "md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]";
}
if (props.lgColSplit === "2/3") {
lgSplitClass = " lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]";
} else if (props.lgColSplit === "3/2") {
lgSplitClass = "lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]";
}
return (
<div
class={`grid grid-cols-1 items-center gap-12 md:gap-16 xl:gap-32 ${
props.reverseOnDesktop ? "[&>*]:md:first:order-1" : ""
} ${mdSplitClass} ${lgSplitClass} ${props.class ?? ""}`}
>
{props.children}
</div>
);
}