From e0716339acbe4a73d518a199945c036fbc21012a Mon Sep 17 00:00:00 2001 From: ginifizz Date: Tue, 25 Oct 2022 11:58:38 +0200 Subject: [PATCH 1/3] feat: update style with tailwind --- .../next/components/common/Pagination.tsx | 69 +++++++++++++------ .../next/components/common/ReferenceLinks.tsx | 2 +- templates/next/components/foo/Form.tsx | 40 ++++++----- templates/next/components/foo/List.tsx | 42 ++++++----- templates/next/components/foo/Show.tsx | 39 +++++++---- 5 files changed, 120 insertions(+), 72 deletions(-) diff --git a/templates/next/components/common/Pagination.tsx b/templates/next/components/common/Pagination.tsx index d55c675b..211f1e60 100644 --- a/templates/next/components/common/Pagination.tsx +++ b/templates/next/components/common/Pagination.tsx @@ -17,28 +17,53 @@ const Pagination = ({ collection }: Props) => { } = view; return ( - +
+ +
); }; diff --git a/templates/next/components/common/ReferenceLinks.tsx b/templates/next/components/common/ReferenceLinks.tsx index c6846185..e4c28891 100644 --- a/templates/next/components/common/ReferenceLinks.tsx +++ b/templates/next/components/common/ReferenceLinks.tsx @@ -20,7 +20,7 @@ const ReferenceLinks: FunctionComponent = ({ items }) => { return ( - + {typeof items === "string" ? items : items.name} diff --git a/templates/next/components/foo/Form.tsx b/templates/next/components/foo/Form.tsx index b922f3a3..81ebf783 100644 --- a/templates/next/components/foo/Form.tsx +++ b/templates/next/components/foo/Form.tsx @@ -50,8 +50,15 @@ export const Form: FunctionComponent = ({ {{{lc}}} }) => { }; return ( -
-

{ {{{lc}}} ? `Edit {{{ucf}}} ${ {{~lc}}['@id']}` : `Create {{{ucf}}}` }

+
+ + + {`< Back to list`} + + +

+ { {{{lc}}} ? `Edit {{{ucf}}} ${ {{~lc}}['@id']}` : `Create {{{ucf}}}` } +

= ({ {{{lc}}} }) => { handleSubmit, isSubmitting, }) => ( -
+ {{#each formFields}} -
+
{{#if isRelations}} -
{{name}}
+
{{name}}
( -
+
{values.{{name}} && values.{{name}}.length > 0 ? ( values.{{name}}.map((item: any, index: number) => (
@@ -146,7 +153,7 @@ export const Form: FunctionComponent = ({ {{{lc}}} }) => { )} /> {{else}} - + = ({ {{{lc}}} }) => { {{#if step}}step="{{{step}}}"{{/if}} placeholder="{{{description}}}" {{#if required}}required={true}{{/if}} - className={`form-control${errors.{{name}} && touched.{{name}} ? ' is-invalid' : ''}`} + className={`mt-1 block w-full ${errors.{{name}} && touched.{{name}} ? 'border-red-500' : ''}`} aria-invalid={errors.{{name}} && touched.{{name~}} ? 'true' : undefined} onChange={handleChange} onBlur={handleBlur} /> @@ -175,8 +182,8 @@ export const Form: FunctionComponent = ({ {{{lc}}} }) => { {{/each}} {status && status.msg && (
@@ -185,7 +192,7 @@ export const Form: FunctionComponent = ({ {{{lc}}} }) => { )} )} +
); }; diff --git a/templates/next/components/foo/List.tsx b/templates/next/components/foo/List.tsx index 7e5d0ab4..592e6903 100644 --- a/templates/next/components/foo/List.tsx +++ b/templates/next/components/foo/List.tsx @@ -10,26 +10,30 @@ interface Props { } export const List: FunctionComponent = ({ {{{lc}}}s }) => ( -
-

{{{ucf}}} List

+
+
+

{{{ucf}}} List

- Create + + Create + - - + +
+ {{#each fields}} {{/each}} - - + { {{{lc}}}s && ({{{lc}}}s.length !== 0) && {{{lc}}}s.map( ( {{{lc}}} ) => ( {{{lc}}}['@id'] && - - + {{#each fields}} @@ -49,19 +53,23 @@ export const List: FunctionComponent = ({ {{{lc}}}s }) => ( {{/if}} {{/each}} - - diff --git a/templates/next/components/foo/Show.tsx b/templates/next/components/foo/Show.tsx index 855c13ca..c3f6c036 100644 --- a/templates/next/components/foo/Show.tsx +++ b/templates/next/components/foo/Show.tsx @@ -30,20 +30,25 @@ export const Show: FunctionComponent = ({ {{{lc}}}, text }) => { }; return ( -
+
{`Show {{{ucf}}} ${ {{~lc}}['@id']}`}
id{{name}} +
+
+ - - - Show + + + + + + - -