Skip to content

Commit 5aa969f

Browse files
authored
Build RAC Tailwind example in Verdaccio (#4335)
1 parent f422c5c commit 5aa969f

File tree

6 files changed

+26
-23
lines changed

6 files changed

+26
-23
lines changed

.circleci/comment.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ async function run() {
5050
body: `Verdaccio builds:
5151
[CRA Test App](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/build/index.html)
5252
[NextJS Test App](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/next/index.html)
53+
[RAC Tailwind Example](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/rac-tailwind/index.html)
5354
[CRA Test App Size](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/publish-stats/build-stats.txt)
5455
[NextJS App Size](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/publish-stats/next-build-stats.txt)
5556
[Publish stats](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/publish-stats/publish.json)

examples/rac-tailwind/package.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@
22
"name": "rac-tailwind-example",
33
"private": true,
44
"scripts": {
5-
"start": "parcel src/index.html"
5+
"start": "parcel src/index.html",
6+
"build": "parcel build src/index.html"
67
},
7-
"workspaces": [
8-
"../../packages/react-aria-components",
9-
"../../packages/react-aria",
10-
"../../packages/react-stately",
11-
"../../packages/*/*"
12-
],
138
"dependencies": {
149
"@heroicons/react": "^2.0.16",
1510
"parcel": "^2.8.3",
@@ -22,9 +17,5 @@
2217
},
2318
"devDependencies": {
2419
"process": "^0.11.10"
25-
},
26-
"resolutions": {
27-
"react": "link:../../node_modules/react",
28-
"react-dom": "link:../../node_modules/react-dom"
2920
}
3021
}

examples/rac-tailwind/src/App.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function App() {
1010
return (
1111
<>
1212
<h1 className="text-center text-4xl font-serif font-semibold mb-8">React Aria Components 🤝 Tailwind CSS</h1>
13-
<div className="grid gap-4 grid-cols-[repeat(auto-fit,theme(width.96))] auto-rows-fr justify-center">
13+
<div className="grid gap-4 grid-cols-1 md:grid-cols-[repeat(auto-fit,theme(width.96))] auto-rows-fr justify-center">
1414
<MenuExample />
1515
<SelectExample />
1616
<DatePickerExample />
@@ -53,27 +53,27 @@ function MenuExample() {
5353

5454
function MenuItem(props) {
5555
return <Item {...props} className={({ isFocused }) => `
56-
group flex w-full items-center rounded-md px-3 py-2 text-sm outline-none cursor-default
56+
group flex w-full items-center rounded-md px-3 py-2 sm:text-sm outline-none cursor-default
5757
${isFocused ? 'bg-violet-500 text-white' : 'text-gray-900'}
5858
`} />;
5959
}
6060

6161
function OverlayButton(props) {
62-
return <Button {...props} className="inline-flex items-center justify-center rounded-md bg-black bg-opacity-20 bg-clip-padding border border-white/20 px-3.5 py-2 text-sm font-medium text-white data-[hovered]:bg-opacity-30 data-[pressed]:bg-opacity-40 transition-colors cursor-default outline-none data-[focus-visible]:ring-2 data-[focus-visible]:ring-white/75" />;
62+
return <Button {...props} className="inline-flex items-center justify-center rounded-md bg-black bg-opacity-20 bg-clip-padding border border-white/20 px-3.5 py-2 sm:text-sm font-medium text-white data-[hovered]:bg-opacity-30 data-[pressed]:bg-opacity-40 transition-colors cursor-default outline-none data-[focus-visible]:ring-2 data-[focus-visible]:ring-white/75" />;
6363
}
6464

6565
function SelectExample() {
6666
return (
6767
<div className="bg-gradient-to-r from-amber-500 to-rose-500 p-8 rounded-lg flex justify-center">
6868
<Select className="flex flex-col gap-1 w-5/6">
6969
<Label className="text-sm">Favorite Animal</Label>
70-
<Button className="flex relative w-full cursor-default rounded-lg bg-white bg-white bg-opacity-90 data-[pressed]:bg-opacity-100 transition py-2 pl-3 pr-2 text-left shadow-md text-gray-700 focus:outline-none data-[focus-visible]:border-indigo-500 data-[focus-visible]:ring-2 data-[focus-visible]:ring-black text-sm">
70+
<Button className="flex relative w-full cursor-default rounded-lg bg-white bg-white bg-opacity-90 data-[pressed]:bg-opacity-100 transition py-2 pl-3 pr-2 text-left shadow-md text-gray-700 focus:outline-none data-[focus-visible]:border-indigo-500 data-[focus-visible]:ring-2 data-[focus-visible]:ring-black sm:text-sm">
7171
<SelectValue className="flex-1 truncate data-[placeholder]:italic" />
7272
<ChevronUpDownIcon
7373
className="h-5 w-5 text-gray-500"
7474
aria-hidden="true" />
7575
</Button>
76-
<Popover className="max-h-60 w-[--trigger-width] overflow-auto rounded-md bg-white text-base shadow-lg ring-1 ring-black ring-opacity-5 text-sm data-[entering]:animate-in data-[entering]:fade-in data-[exiting]:animate-out data-[exiting]:fade-out fill-mode-forwards">
76+
<Popover className="max-h-60 w-[--trigger-width] overflow-auto rounded-md bg-white text-base shadow-lg ring-1 ring-black ring-opacity-5 sm:text-sm data-[entering]:animate-in data-[entering]:fade-in data-[exiting]:animate-out data-[exiting]:fade-out fill-mode-forwards">
7777
<ListBox className="outline-none p-1 [--focus-bg:theme(colors.rose.600)]">
7878
<ListBoxItem>Aardvark</ListBoxItem>
7979
<ListBoxItem>Cat</ListBoxItem>
@@ -116,7 +116,7 @@ function ComboBoxExample() {
116116
<ComboBox className="flex flex-col gap-1 w-5/6">
117117
<Label className="text-sm text-black">Favorite Animal</Label>
118118
<div className="relative w-full cursor-default overflow-hidden rounded-lg bg-white bg-opacity-90 focus-within:bg-opacity-100 transition text-left shadow-md [&:has([data-focus-visible])]:ring-2 [&:has([data-focus-visible])]:ring-black sm:text-sm">
119-
<Input className="w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 bg-transparent outline-none" />
119+
<Input className="w-full border-none py-2 pl-3 pr-10 sm:text-sm leading-5 text-gray-900 bg-transparent outline-none" />
120120
<Button className="absolute inset-y-0 right-0 flex items-center px-2 cursor-default transition border-l border-l-sky-200 data-[pressed]:bg-sky-100">
121121
<ChevronUpDownIcon
122122
className="h-5 w-5 text-gray-500"
@@ -179,9 +179,9 @@ function MyTab(props) {
179179
<Tab
180180
{...props}
181181
className={({isSelected, isFocusVisible}) => `
182-
w-full rounded-full py-2.5 text-sm font-medium leading-5 text-center cursor-default ring-black outline-none transition-colors
182+
w-full rounded-full py-2.5 sm:text-sm font-medium leading-5 text-center cursor-default ring-black outline-none transition-colors
183183
${isFocusVisible ? 'ring-2' : ''}
184-
${isSelected ? 'text-emerald-700 bg-white shadow' : 'text-lime-50 hover:bg-white/[0.12] hover:text-white'}
184+
${isSelected ? 'text-emerald-700 bg-white shadow' : 'text-lime-50 data-[hovered]:bg-white/[0.12] data-[hovered]:text-white data-[pressed]:bg-white/[0.12] data-[pressed]:text-white'}
185185
`} />
186186
);
187187
}
@@ -355,7 +355,7 @@ function SliderExample() {
355355
return (
356356
<div className="bg-gradient-to-r from-purple-500 to-pink-500 p-8 rounded-lg flex items-center justify-center">
357357
<Slider defaultValue={30} className="w-5/6">
358-
<div className="flex text-sm">
358+
<div className="flex sm:text-sm">
359359
<Label className="flex-1">Opacity</Label>
360360
<SliderOutput />
361361
</div>
@@ -395,7 +395,7 @@ function DatePickerExample() {
395395
<DatePicker className="flex flex-col gap-1 w-5/6">
396396
<Label className="text-sm">Date</Label>
397397
<Group className="flex rounded-lg bg-white/90 focus-within:bg-white [&:has([data-pressed])]:bg-white transition pl-3 text-left shadow-md text-gray-700 focus:outline-none data-[focus-visible]:[&:not(:has(button[data-focus-visible]))]:ring-2 data-[focus-visible]:ring-black">
398-
<DateInput className="flex flex-1 py-2 text-sm input">
398+
<DateInput className="flex flex-1 py-2 sm:text-sm input">
399399
{(segment) => <DateSegment segment={segment} className="px-0.5 box-content tabular-nums text-right outline-none rounded-sm focus:bg-violet-700 focus:text-white group caret-transparent data-[placeholder]:italic" />}
400400
</DateInput>
401401
<Button className="cursor-default outline-none px-2 transition border-l border-l-purple-200 rounded-r-lg data-[pressed]:bg-purple-100 data-[focus-visible]:ring-2 data-[focus-visible]:ring-black">
@@ -510,7 +510,7 @@ function TableExample() {
510510
}, [sortDescriptor]);
511511

512512
return (
513-
<div className="bg-gradient-to-r from-indigo-500 to-violet-500 p-8 rounded-lg flex items-center justify-center col-span-2">
513+
<div className="bg-gradient-to-r from-indigo-500 to-violet-500 p-8 rounded-lg flex items-center justify-center md:col-span-2">
514514
<div className="max-h-[280px] overflow-auto relative bg-white rounded-lg shadow text-gray-600">
515515
<Table aria-label="Stocks" selectionMode="single" selectionBehavior="replace" sortDescriptor={sortDescriptor} onSortChange={setSortDescriptor} className="border-separate border-spacing-0">
516516
<TableHeader>

examples/rac-tailwind/src/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
<head>
44
<meta charset="utf-8">
55
<title>React Aria Components 🤝 Tailwind CSS</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
67
<link rel="stylesheet" href="style.css">
78
</head>
8-
<body class="bg-gray-800 text-gray-100 p-8">
9+
<body class="bg-gray-800 text-gray-100 p-4 sm:p-8">
910
<div id="root"></div>
1011
<script type="module" src="index.js"></script>
1112
</body>

examples/rac-tailwind/src/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4+
5+
* {
6+
-webkit-tap-highlight-color: transparent;
7+
}

scripts/verdaccio.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ then
116116
mv next-build-stats.txt ../../$verdaccio_path/publish-stats
117117
mv out ../../$verdaccio_path/next
118118

119+
# Install/build RAC Tailwind app
120+
cd ../../examples/rac-tailwind
121+
yarn install
122+
yarn build --public-url ./
123+
mv dist ../../$verdaccio_path/rac-tailwind
124+
119125
cd ../..
120126

121127
# Get the tarball size of each published package.

0 commit comments

Comments
 (0)