From dcb47b1bceb01078245ebeb7a5056fae4f921ce3 Mon Sep 17 00:00:00 2001 From: Anshul Goel Date: Thu, 19 Jan 2023 13:25:46 +0530 Subject: [PATCH 1/5] Form component update, add forgot password feature, add form page in playground --- package-lock.json | 8 +- packages/@holaplexui-playground/package.json | 6 +- .../@holaplexui-playground/pages/form.tsx | 83 +++++++++++++++++++ .../@holaplexui-playground/styles/globals.css | 28 +++++-- packages/@holaplexui-react/package.json | 1 + .../@holaplexui-react/src/components/Form.tsx | 71 ++++++++++++++-- .../@holaplexui-react/tailwind.config.cjs | 2 +- 7 files changed, 177 insertions(+), 22 deletions(-) create mode 100644 packages/@holaplexui-playground/pages/form.tsx diff --git a/package-lock.json b/package-lock.json index 1c3e631..67c1c2c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5651,7 +5651,7 @@ "name": "@holaplex/ui-library-playground", "version": "0.1.0", "dependencies": { - "@holaplex/ui-library-react": "*", + "@holaplex/ui-library-react": "^0.4.0", "@next/font": "13.1.1", "@types/node": "18.11.18", "@types/react": "18.0.26", @@ -5827,7 +5827,7 @@ }, "packages/@holaplexui-react": { "name": "@holaplex/ui-library-react", - "version": "0.3.0", + "version": "0.4.0", "dependencies": { "@headlessui/react": "^1.7.4", "@heroicons/react": "^2.0.13", @@ -5838,6 +5838,7 @@ "react-intersection-observer": "^9.4.1" }, "devDependencies": { + "@tailwindcss/forms": "^0.5.3", "@types/node": "^18.11.18", "@types/react": "^18.0.26", "@types/react-dom": "^18.0.8", @@ -5950,7 +5951,7 @@ "@holaplex/ui-library-playground": { "version": "file:packages/@holaplexui-playground", "requires": { - "@holaplex/ui-library-react": "*", + "@holaplex/ui-library-react": "^0.4.0", "@next/font": "13.1.1", "@tailwindcss/forms": "^0.5.3", "@tailwindcss/typography": "^0.5.8", @@ -6088,6 +6089,7 @@ "@headlessui/react": "^1.7.4", "@heroicons/react": "^2.0.13", "@react-hook/window-size": "^3.1.1", + "@tailwindcss/forms": "*", "@types/node": "^18.11.18", "@types/react": "^18.0.26", "@types/react-dom": "^18.0.8", diff --git a/packages/@holaplexui-playground/package.json b/packages/@holaplexui-playground/package.json index bcc1be8..0fad17f 100644 --- a/packages/@holaplexui-playground/package.json +++ b/packages/@holaplexui-playground/package.json @@ -9,7 +9,7 @@ "lint": "next lint" }, "dependencies": { - "@holaplex/ui-library-react": "*", + "@holaplex/ui-library-react": "^0.4.0", "@next/font": "13.1.1", "@types/node": "18.11.18", "@types/react": "18.0.26", @@ -20,11 +20,11 @@ "react-dom": "18.2.0" }, "devDependencies": { - "eslint": "8.30.0", - "eslint-config-next": "13.1.1", "@tailwindcss/forms": "^0.5.3", "@tailwindcss/typography": "^0.5.8", "autoprefixer": "^10.4.13", + "eslint": "8.30.0", + "eslint-config-next": "13.1.1", "postcss": "^8.4.20", "tailwindcss": "^3.2.4", "typescript": "4.9.4" diff --git a/packages/@holaplexui-playground/pages/form.tsx b/packages/@holaplexui-playground/pages/form.tsx new file mode 100644 index 0000000..aec19da --- /dev/null +++ b/packages/@holaplexui-playground/pages/form.tsx @@ -0,0 +1,83 @@ +import { Form } from '@holaplex/ui-library-react'; + +function HidePasswordIcon({ size = 16, color = 'none', className = '' }) { + return ( + + + + + ); +} + +function ShowPasswordIcon({ size = 16, color = 'none', className = '' }) { + return ( + + + + + + + ); +} + +export default function App() { + return ( +
+
+ + + + } + hidePasswordIcon={} + /> + +
+ ); +} diff --git a/packages/@holaplexui-playground/styles/globals.css b/packages/@holaplexui-playground/styles/globals.css index 07cee26..86101d8 100644 --- a/packages/@holaplexui-playground/styles/globals.css +++ b/packages/@holaplexui-playground/styles/globals.css @@ -104,11 +104,11 @@ a { text-decoration: none; } -@media (prefers-color-scheme: dark) { +/* @media (prefers-color-scheme: dark) { html { color-scheme: dark; } -} +} */ .spinner-border { vertical-align: -0.125em; @@ -116,30 +116,40 @@ a { border-right-color: transparent; } -.form-label { - @apply mb-6 flex flex-col gap-2; -} - .avatar { @apply bg-blue-500; } +.form-label { + @apply flex flex-col gap-2; +} + .form-label-text { - @apply font-semibold text-white; + @apply font-semibold text-sm; } .form-error { @apply whitespace-nowrap text-left text-sm text-red-500; } +.form-input-container { + @apply flex flex-row w-full items-center rounded-md border border-gray-800 bg-white; +} .form-input { - @apply flex w-full flex-row items-center justify-start rounded-md border border-gray-800 bg-gray-800 p-2 text-white focus-within:border-white focus:ring-0 focus:ring-offset-0; + @apply text-black w-full focus-within:border-white focus:ring-0 focus:ring-offset-0; } +.form-input-icon-container { + @apply p-2 bg-gray-200 rounded-md ml-1 mr-1; +} .form-input-error { @apply border-red-500; } +.form-show-password-container { + @apply p-2 bg-gray-200 rounded-md ml-1 mr-1; +} + .price-text { @apply text-white; -} \ No newline at end of file +} diff --git a/packages/@holaplexui-react/package.json b/packages/@holaplexui-react/package.json index 5af292f..7aadc96 100644 --- a/packages/@holaplexui-react/package.json +++ b/packages/@holaplexui-react/package.json @@ -24,6 +24,7 @@ "react-intersection-observer": "^9.4.1" }, "devDependencies": { + "@tailwindcss/forms": "^0.5.3", "@types/node": "^18.11.18", "@types/react": "^18.0.26", "@types/react-dom": "^18.0.8", diff --git a/packages/@holaplexui-react/src/components/Form.tsx b/packages/@holaplexui-react/src/components/Form.tsx index c238a0f..6caff26 100644 --- a/packages/@holaplexui-react/src/components/Form.tsx +++ b/packages/@holaplexui-react/src/components/Form.tsx @@ -6,6 +6,7 @@ import { forwardRef, LegacyRef, InputHTMLAttributes, + useState, } from 'react'; import { FieldError } from 'react-hook-form'; @@ -23,12 +24,13 @@ interface FormLabelProps function FormLabel({ name, className, children, ...props }: FormLabelProps): JSX.Element { return ( -