feat: create edit collection page

This commit is contained in:
Sonny
2024-05-14 23:57:54 +02:00
committed by Sonny
parent 6b327a5b1e
commit 6b4cfd9926
13 changed files with 180 additions and 38 deletions

View File

@@ -1,12 +1,20 @@
import styled from '@emotion/styled';
import { ChangeEvent, InputHTMLAttributes, useState } from 'react';
import FormField from '~/components/common/form/_form_field';
import Input from '~/components/common/form/_input';
// TODO: create a global style variable (fontSize)
const InputLegend = styled.p(({ theme }) => ({
fontSize: '12px',
color: theme.colors.lightRed,
}));
interface InputProps
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
label: string;
name: string;
value?: string;
errors?: string[];
onChange?: (name: string, value: string) => void;
}
@@ -14,6 +22,7 @@ export default function TextBox({
name,
label,
value = '',
errors = [],
onChange,
required = false,
...props
@@ -39,6 +48,8 @@ export default function TextBox({
value={inputValue}
placeholder={props.placeholder ?? 'Type something...'}
/>
{errors.length > 0 &&
errors.map((error) => <InputLegend>{error}</InputLegend>)}
</FormField>
);
}