mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-02-23 15:34:21 +01:00
update: update story error msgs, update tags-input styling
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
|
||||
import { useController } from "react-hook-form";
|
||||
import Badge from "src/Components/Badge/Badge";
|
||||
// import CreatableSelect from 'react-select/creatable';
|
||||
import Select from 'react-select'
|
||||
import { OnChangeValue, StylesConfig, components, OptionProps } from "react-select";
|
||||
@@ -73,12 +72,23 @@ const colourStyles: StylesConfig = {
|
||||
control: (styles, state) => ({
|
||||
...styles,
|
||||
padding: '1px 0',
|
||||
border: 'none'
|
||||
border: 'none',
|
||||
boxShadow: 'none',
|
||||
|
||||
":hover": {
|
||||
cursor: "pointer"
|
||||
}
|
||||
|
||||
}),
|
||||
indicatorSeparator: (styles, state) => ({
|
||||
multiValueRemove: (styles) => ({
|
||||
...styles,
|
||||
display: "none"
|
||||
":hover": {
|
||||
background: 'none'
|
||||
}
|
||||
}),
|
||||
indicatorsContainer: () => ({ display: 'none' }),
|
||||
clearIndicator: () => ({ display: 'none' }),
|
||||
indicatorSeparator: () => ({ display: "none" }),
|
||||
input: (styles, state) => ({
|
||||
...styles,
|
||||
" input": {
|
||||
@@ -135,13 +145,11 @@ export default function TagsInput({
|
||||
isMulti
|
||||
isOptionDisabled={() => maxReached}
|
||||
placeholder={currentPlaceholder}
|
||||
isClearable
|
||||
noOptionsMessage={() => {
|
||||
return maxReached
|
||||
? "You've reached the max number of tags."
|
||||
: "No tags available";
|
||||
}}
|
||||
|
||||
closeMenuOnSelect={false}
|
||||
value={value.map(transformer.tagToOption)}
|
||||
onChange={handleChange as any}
|
||||
|
||||
@@ -28,9 +28,9 @@ const FileSchema = yup.lazy((value: string | File[]) => {
|
||||
})
|
||||
|
||||
const schema = yup.object({
|
||||
title: yup.string().trim().required().min(10, 'the title is too short'),
|
||||
tags: yup.array().required().min(1, 'please pick at least one relevant tag'),
|
||||
body: yup.string().required().min(50, 'stories should have a minimum of 10 words'),
|
||||
title: yup.string().trim().required().min(10, 'Story title must be 2+ words'),
|
||||
tags: yup.array().required().min(1, 'Add at least one tag'),
|
||||
body: yup.string().required().min(50, 'Post must contain at least 10+ words'),
|
||||
cover_image: yup.array().of(FileSchema as any)
|
||||
|
||||
}).required();
|
||||
|
||||
Reference in New Issue
Block a user