From 486e3a63844247facbed2200d0ac137fa9891283 Mon Sep 17 00:00:00 2001 From: wil Date: Tue, 8 Oct 2024 13:08:23 -0400 Subject: [PATCH] Feature/ add text 2 (#45) * combobox styling * text editor can not autofocus text area * better styles and input method for the color picker --- .../DialogEditText/DialogEditText.tsx | 4 +- src/components/ui/Button.tsx | 2 +- src/components/ui/ComboBox.tsx | 18 +- src/components/ui/TextArea.tsx | 72 ++++---- src/components/ui/TextEditor/ColorPicker.tsx | 98 +++++++++++ src/components/ui/TextEditor/TextEditor.tsx | 156 ++++++++++-------- 6 files changed, 233 insertions(+), 117 deletions(-) create mode 100644 src/components/ui/TextEditor/ColorPicker.tsx diff --git a/src/components/features/DialogEditText/DialogEditText.tsx b/src/components/features/DialogEditText/DialogEditText.tsx index e6c8e52646..58ee9c7a19 100644 --- a/src/components/features/DialogEditText/DialogEditText.tsx +++ b/src/components/features/DialogEditText/DialogEditText.tsx @@ -1,4 +1,4 @@ -import { useState, ChangeEvent } from "react"; +import { useState } from "react"; import { twMerge } from "tailwind-merge"; import { Dialog, DialogPanel, DialogTitle } from "@headlessui/react"; import { Button, TextEditor } from "~/components/ui"; @@ -72,7 +72,7 @@ export const DialogEditText = ({ diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsx index c32650a972..bc81098587 100644 --- a/src/components/ui/Button.tsx +++ b/src/components/ui/Button.tsx @@ -31,7 +31,7 @@ export const Button = ({ return "bg-tertiary hover:bg-tertiary-400 text-white focus-visible:outline-tertiary-600"; } case "secondary": { - return "bg-secondary hover:bg-secondary-900 text-white focus-visible:outline-secondary"; + return "bg-secondary-600 hover:bg-secondary-400 text-white focus-visible:outline-secondary"; } case "action": { return " bg-action hover:bg-action-500 text-white focus-visible:outline-action"; diff --git a/src/components/ui/ComboBox.tsx b/src/components/ui/ComboBox.tsx index 84be5b3638..dd9717dbaf 100644 --- a/src/components/ui/ComboBox.tsx +++ b/src/components/ui/ComboBox.tsx @@ -29,25 +29,25 @@ export const Combobox = ({ options, value, onChange }: ComboBoxInterface) => { onChange={onChange} onClose={() => setQuery("")} > -
+
font} onChange={(event) => setQuery(event.target.value)} /> - - + +
- + {filteredOptions.map((option, idx) => ( {option} diff --git a/src/components/ui/TextArea.tsx b/src/components/ui/TextArea.tsx index 8ded7eaf44..a66eb28f0c 100644 --- a/src/components/ui/TextArea.tsx +++ b/src/components/ui/TextArea.tsx @@ -1,4 +1,4 @@ -import { TextareaHTMLAttributes } from "react"; +import { TextareaHTMLAttributes, forwardRef } from "react"; import { twMerge } from "tailwind-merge"; import { kebabCase } from "~/utilities"; @@ -16,39 +16,39 @@ export interface TextareaInterface label?: string; resize?: ResizeType; } -export const Textarea = ({ - className, - label, - resize = "vertical", - id, - ...rest -}: TextareaInterface) => { - return ( -
- {label && } +export const Textarea = forwardRef( + ( + { className, label, resize = "vertical", id, ...rest }: TextareaInterface, + ref, + ) => { + return ( +
+ {label && } -