From 7defccb009bcfe4d96e54fa55bd61be72e8b4132 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 11 Feb 2025 10:15:35 -0500 Subject: [PATCH] Better mobile layout --- src/App.tsx | 1 + src/components/ColorPicker.tsx | 56 ++++++++++++++++++------------- src/components/TailwindColors.tsx | 7 ++-- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index e13d95f..09767df 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,5 @@ import { ColorPicker } from './components/ColorPicker' +import { ColorPickerVertical } from './components/ColorPickerVertical' function App() { return ( diff --git a/src/components/ColorPicker.tsx b/src/components/ColorPicker.tsx index 2081a93..0cb32c6 100644 --- a/src/components/ColorPicker.tsx +++ b/src/components/ColorPicker.tsx @@ -139,27 +139,26 @@ export function ColorPicker() { } return ( -
-
+
+

Color Picker

-

Find and convert colors in different formats

-
+
{/* Left Column: Color Picker and Input */}
-
- {/* Color Preview */} -
+
+ {/* Color Preview and Picker */} +
-
- +
+ {closestTailwind.isExactMatch ? ( Tailwind: {closestTailwind.name} ) : ( @@ -167,15 +166,26 @@ export function ColorPicker() { )}
-
- {/* Color Picker */} -
- + {/* Color Picker */} +
+ +
+
+ +
{/* Color Format Inputs */} -
+
@@ -202,7 +212,7 @@ export function ColorPicker() { id="rgb-value" value={colorValues.rgb} onChange={(e) => handleInputChange(e.target.value, 'rgb')} - className="block w-full rounded-md border-0 py-1.5 px-3 pr-10 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" + className="block w-full text-sm sm:text-base rounded-md border-0 py-1.5 px-3 pr-10 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" />
@@ -218,7 +228,7 @@ export function ColorPicker() { id="hsl-value" value={colorValues.hsl} onChange={(e) => handleInputChange(e.target.value, 'hsl')} - className="block w-full rounded-md border-0 py-1.5 px-3 pr-10 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" + className="block w-full text-sm sm:text-base rounded-md border-0 py-1.5 px-3 pr-10 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" />
@@ -234,7 +244,7 @@ export function ColorPicker() { id="hsb-value" value={colorValues.hsb} onChange={(e) => handleInputChange(e.target.value, 'hsb')} - className="block w-full rounded-md border-0 py-1.5 px-3 pr-10 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" + className="block w-full text-sm sm:text-base rounded-md border-0 py-1.5 px-3 pr-10 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" />
@@ -250,7 +260,7 @@ export function ColorPicker() { id="oklch-value" value={colorValues.oklch} onChange={(e) => handleInputChange(e.target.value, 'oklch')} - className="block w-full rounded-md border-0 py-1.5 px-3 pr-10 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" + className="block w-full text-sm sm:text-base rounded-md border-0 py-1.5 px-3 pr-10 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" />
@@ -266,7 +276,7 @@ export function ColorPicker() { id="tailwind-value" value={colorValues.tailwind} readOnly - className="block w-full rounded-md border-0 py-1.5 px-3 pr-10 text-gray-900 bg-gray-50 shadow-sm ring-1 ring-inset ring-gray-300 sm:text-sm sm:leading-6" + className="block w-full text-sm sm:text-base rounded-md border-0 py-1.5 px-3 pr-10 text-gray-900 bg-gray-50 shadow-sm ring-1 ring-inset ring-gray-300 sm:text-sm sm:leading-6" />
@@ -277,8 +287,8 @@ export function ColorPicker() {
{/* Right Column: Tailwind Colors */} -
-
+
+
{ // Always set the hex color for the color picker diff --git a/src/components/TailwindColors.tsx b/src/components/TailwindColors.tsx index 2343104..0ac88cd 100644 --- a/src/components/TailwindColors.tsx +++ b/src/components/TailwindColors.tsx @@ -46,16 +46,13 @@ export function TailwindColors({ onColorSelect, selectedColor }: TailwindColorsP } return ( -
-
- Tailwind Color Reference -
+
{/* Color rows */} {orderedColors.map(colorName => ( -
+
{colorName}
{shades.map(shade => {