From b8b481b57bd83fe157856c428bac0bcf237660e6 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sun, 25 Jul 2021 16:41:54 -0600 Subject: [PATCH] ui: fix borked styling --- .../components/admin/AdminCheckbox.tsx | 16 ++++--- .../scripts/components/elements/Field.tsx | 11 ++--- .../elements/FormikFieldWrapper.tsx | 6 ++- .../scripts/components/elements/Input.tsx | 8 +++- .../components/elements/InputError.tsx | 5 +-- .../server/files/FileDropdownMenu.tsx | 2 +- .../components/server/files/FileObjectRow.tsx | 45 ++++++++++--------- .../server/files/SelectFileCheckbox.tsx | 30 ++++++------- 8 files changed, 68 insertions(+), 55 deletions(-) diff --git a/resources/scripts/components/admin/AdminCheckbox.tsx b/resources/scripts/components/admin/AdminCheckbox.tsx index 98643073..73241d4d 100644 --- a/resources/scripts/components/admin/AdminCheckbox.tsx +++ b/resources/scripts/components/admin/AdminCheckbox.tsx @@ -14,12 +14,14 @@ export const TableCheckbox = styled(Input)` export default ({ name, checked, onChange }: { name: string, checked: boolean, onChange(e: React.ChangeEvent): void }) => { return ( - +
+ +
); }; diff --git a/resources/scripts/components/elements/Field.tsx b/resources/scripts/components/elements/Field.tsx index e7ea1667..b9e319e1 100644 --- a/resources/scripts/components/elements/Field.tsx +++ b/resources/scripts/components/elements/Field.tsx @@ -2,6 +2,7 @@ import React, { forwardRef } from 'react'; import { Field as FormikField, FieldProps } from 'formik'; import Input from '@/components/elements/Input'; import Label from '@/components/elements/Label'; +import InputError from '@/components/elements/InputError'; interface OwnProps { name: string; @@ -28,13 +29,9 @@ const Field = forwardRef(({ id, name, light = false, la isLight={light} hasError={!!(touched[field.name] && errors[field.name])} /> - {touched[field.name] && errors[field.name] ? -

- {(errors[field.name] as string).charAt(0).toUpperCase() + (errors[field.name] as string).slice(1)} -

- : - description ?

{description}

: null - } + + {description || null} + ) } diff --git a/resources/scripts/components/elements/FormikFieldWrapper.tsx b/resources/scripts/components/elements/FormikFieldWrapper.tsx index 208f47a2..cf3c0b1b 100644 --- a/resources/scripts/components/elements/FormikFieldWrapper.tsx +++ b/resources/scripts/components/elements/FormikFieldWrapper.tsx @@ -17,7 +17,11 @@ const FormikFieldWrapper = ({ id, name, label, className, description, validate, { ({ field, form: { errors, touched } }: FieldProps) => ( -
+
{label && } {children} diff --git a/resources/scripts/components/elements/Input.tsx b/resources/scripts/components/elements/Input.tsx index 7e7f8294..e9dc0012 100644 --- a/resources/scripts/components/elements/Input.tsx +++ b/resources/scripts/components/elements/Input.tsx @@ -77,7 +77,13 @@ const Input = styled.input` } } `; -const Textarea = styled.textarea`${inputStyle}`; +const Textarea = styled.textarea` + ${inputStyle}; + + & + .input-help { + ${tw`mt-0`}; + } +`; export { Textarea }; export default Input; diff --git a/resources/scripts/components/elements/InputError.tsx b/resources/scripts/components/elements/InputError.tsx index 3b810454..b8365755 100644 --- a/resources/scripts/components/elements/InputError.tsx +++ b/resources/scripts/components/elements/InputError.tsx @@ -1,6 +1,5 @@ import React from 'react'; import { FormikErrors, FormikTouched } from 'formik'; -import tw from 'twin.macro'; import { capitalize } from '@/helpers'; interface Props { @@ -12,7 +11,7 @@ interface Props { const InputError = ({ errors, touched, name, children }: Props) => ( touched[name] && errors[name] ? -

+

{typeof errors[name] === 'string' ? capitalize(errors[name] as string) : @@ -21,7 +20,7 @@ const InputError = ({ errors, touched, name, children }: Props) => (

: <> - {children ?

{children}

: null} + {children ?

{children}

: null} ); diff --git a/resources/scripts/components/server/files/FileDropdownMenu.tsx b/resources/scripts/components/server/files/FileDropdownMenu.tsx index a7dc99cb..b2e231b8 100644 --- a/resources/scripts/components/server/files/FileDropdownMenu.tsx +++ b/resources/scripts/components/server/files/FileDropdownMenu.tsx @@ -139,7 +139,7 @@ const FileDropdownMenu = ({ file }: { file: FileObject }) => { ( -
+
{modal ? modal === 'chmod' ? diff --git a/resources/scripts/components/server/files/FileObjectRow.tsx b/resources/scripts/components/server/files/FileObjectRow.tsx index 8e7e6688..7c376d67 100644 --- a/resources/scripts/components/server/files/FileObjectRow.tsx +++ b/resources/scripts/components/server/files/FileObjectRow.tsx @@ -14,7 +14,7 @@ import { usePermissions } from '@/plugins/usePermissions'; import { join } from 'path'; const Row = styled.div` - ${tw`flex bg-neutral-700 rounded-sm mb-px text-sm hover:text-neutral-100 cursor-pointer items-center no-underline hover:bg-neutral-600`}; + ${tw`flex items-center w-full h-10 px-3 rounded-sm cursor-pointer bg-neutral-700 hover:bg-neutral-600 mb-px`}; `; const Clickable: React.FC<{ file: FileObject }> = memo(({ file, children }) => { @@ -25,13 +25,14 @@ const Clickable: React.FC<{ file: FileObject }> = memo(({ file, children }) => { return ( (!canReadContents || (file.isFile && !file.isEditable())) ? -
+
{children}
: {children} @@ -45,33 +46,37 @@ const FileObjectRow = ({ file }: { file: FileObject }) => ( e.preventDefault(); window.dispatchEvent(new CustomEvent(`pterodactyl:files:ctx:${file.key}`, { detail: e.clientX })); }} + css={tw`h-10`} > - +
+ +
-
+
{file.isFile ? : }
-
- {file.name} +
+ {file.name}
- {file.isFile && -