From 9b7a11dbd02f93ad4ff0da3febde81b5df29639d Mon Sep 17 00:00:00 2001 From: Romulus21 Date: Sun, 17 Sep 2023 10:01:31 +0200 Subject: [PATCH] add form errors --- resources/css/app.css | 7 ++++ resources/js/components/Field.tsx | 3 +- resources/js/hooks/AxiosTools.tsx | 14 ++++++-- resources/js/pages/Auth/ForgotPassword.tsx | 13 ++++--- resources/js/pages/Auth/Login.tsx | 10 ++++-- resources/js/pages/Auth/Reset.tsx | 13 ++++--- resources/js/utilities/form.ts | 41 ++++++++++++++++++++++ 7 files changed, 87 insertions(+), 14 deletions(-) create mode 100644 resources/js/utilities/form.ts diff --git a/resources/css/app.css b/resources/css/app.css index a6697d6..92bf8fa 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -9,3 +9,10 @@ .btn-primary { @apply btn bg-blue-700 border-blue-700 hover:bg-blue-800 focus:bg-blue-800; } + +.form-control .error-message, +.form-control.invalid-control input, +.form-control.invalid-control select, +.form-control.invalid-control textarea { + @apply text-red-600 border-red-600; +} diff --git a/resources/js/components/Field.tsx b/resources/js/components/Field.tsx index b7a5fa7..8bdfc20 100644 --- a/resources/js/components/Field.tsx +++ b/resources/js/components/Field.tsx @@ -5,7 +5,7 @@ import React, { const Field: FC = ({children, type = 'text', ...props}) => { - return
+ return
{children &&