Commit bb6af2d8 authored by tom's avatar tom

description field

parent 4d0d415c
...@@ -9,6 +9,7 @@ import type { PublicTagTypesResponse } from 'types/api/addressMetadata'; ...@@ -9,6 +9,7 @@ import type { PublicTagTypesResponse } from 'types/api/addressMetadata';
import Hint from 'ui/shared/Hint'; import Hint from 'ui/shared/Hint';
import PublicTagsSubmitFieldAddresses from './fields/PublicTagsSubmitFieldAddresses'; import PublicTagsSubmitFieldAddresses from './fields/PublicTagsSubmitFieldAddresses';
import PublicTagsSubmitFieldDescription from './fields/PublicTagsSubmitFieldDescription';
import PublicTagsSubmitFieldRequesterEmail from './fields/PublicTagsSubmitFieldRequesterEmail'; import PublicTagsSubmitFieldRequesterEmail from './fields/PublicTagsSubmitFieldRequesterEmail';
import PublicTagsSubmitFieldRequesterName from './fields/PublicTagsSubmitFieldRequesterName'; import PublicTagsSubmitFieldRequesterName from './fields/PublicTagsSubmitFieldRequesterName';
...@@ -40,7 +41,7 @@ const PublicTagsSubmitForm = ({ config }: Props) => { ...@@ -40,7 +41,7 @@ const PublicTagsSubmitForm = ({ config }: Props) => {
rowGap={{ base: 5, lg: 4 }} rowGap={{ base: 5, lg: 4 }}
templateColumns={{ base: '1fr', lg: '1fr 1fr minmax(0, 200px)', xl: '1fr 1fr minmax(0, 250px)' }} templateColumns={{ base: '1fr', lg: '1fr 1fr minmax(0, 200px)', xl: '1fr 1fr minmax(0, 250px)' }}
> >
<GridItem colSpan={ 3 } as="h2" textStyle="h4"> <GridItem colSpan={{ base: 1, lg: 3 }} as="h2" textStyle="h4">
Company info Company info
</GridItem> </GridItem>
<PublicTagsSubmitFieldRequesterName/> <PublicTagsSubmitFieldRequesterName/>
...@@ -50,7 +51,7 @@ const PublicTagsSubmitForm = ({ config }: Props) => { ...@@ -50,7 +51,7 @@ const PublicTagsSubmitForm = ({ config }: Props) => {
<chakra.div bgColor="blue.100" h={ 20 }/> <chakra.div bgColor="blue.100" h={ 20 }/>
<chakra.div bgColor="yellow.100" h={ 20 }/> <chakra.div bgColor="yellow.100" h={ 20 }/>
<GridItem colSpan={ 3 } as="h2" textStyle="h4" mt={ 3 }> <GridItem colSpan={{ base: 1, lg: 3 }} as="h2" textStyle="h4" mt={ 3 }>
Public tags/labels Public tags/labels
<Hint label="Submit a public tag proposal for our moderation team to review" ml={ 1 } color="link"/> <Hint label="Submit a public tag proposal for our moderation team to review" ml={ 1 } color="link"/>
</GridItem> </GridItem>
...@@ -59,6 +60,11 @@ const PublicTagsSubmitForm = ({ config }: Props) => { ...@@ -59,6 +60,11 @@ const PublicTagsSubmitForm = ({ config }: Props) => {
<chakra.div bgColor="blue.100" h={ 20 }/> <chakra.div bgColor="blue.100" h={ 20 }/>
<chakra.div bgColor="yellow.100" h={ 20 }/> <chakra.div bgColor="yellow.100" h={ 20 }/>
<GridItem colSpan={{ base: 1, lg: 2 }}>
<PublicTagsSubmitFieldDescription/>
</GridItem>
<GridItem/>
<Button <Button
variant="solid" variant="solid"
size="lg" size="lg"
......
...@@ -58,7 +58,7 @@ const PublicTagsSubmitFieldAddresses = () => { ...@@ -58,7 +58,7 @@ const PublicTagsSubmitFieldAddresses = () => {
{ fields.map((field, index) => { { fields.map((field, index) => {
return ( return (
<React.Fragment key={ field.id }> <React.Fragment key={ field.id }>
<GridItem colSpan={ 2 }> <GridItem colSpan={{ base: 1, lg: 2 }}>
<Controller <Controller
name={ `addresses.${ index }.hash` } name={ `addresses.${ index }.hash` }
control={ control } control={ control }
......
import { FormControl, Textarea } from '@chakra-ui/react';
import React from 'react';
import { useController, useFormContext } from 'react-hook-form';
import type { FormFields } from '../types';
import InputPlaceholder from 'ui/shared/InputPlaceholder';
const MAX_LENGTH = 80;
const PublicTagsSubmitFieldDescription = () => {
const { control } = useFormContext<FormFields>();
const { field, fieldState, formState } = useController<FormFields, 'description'>({ control, name: 'description', rules: { maxLength: MAX_LENGTH } });
const isDisabled = formState.isSubmitting;
return (
<FormControl variant="floating" isDisabled={ isDisabled } size={{ base: 'md', lg: 'lg' }}>
<Textarea
{ ...field }
isInvalid={ Boolean(fieldState.error) }
isDisabled={ isDisabled }
autoComplete="off"
maxH="160px"
maxLength={ MAX_LENGTH }
/>
<InputPlaceholder text="Any comments for moderation... Specify the reason for adding tags and color preference(s)." error={ fieldState.error }/>
</FormControl>
);
};
export default React.memo(PublicTagsSubmitFieldDescription);
...@@ -2,4 +2,5 @@ export interface FormFields { ...@@ -2,4 +2,5 @@ export interface FormFields {
requesterName: string; requesterName: string;
requesterEmail: string; requesterEmail: string;
addresses: Array<{ hash: string }>; addresses: Array<{ hash: string }>;
description: string;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment