Direct image upload #184
@ -7,7 +7,8 @@ import {
|
|||||||
} from 'react-router-dom'
|
} from 'react-router-dom'
|
||||||
import {
|
import {
|
||||||
CheckboxFieldUncontrolled,
|
CheckboxFieldUncontrolled,
|
||||||
InputFieldUncontrolled
|
InputFieldUncontrolled,
|
||||||
|
InputFieldWithImageUpload
|
||||||
} from '../../components/Inputs'
|
} from '../../components/Inputs'
|
||||||
import { ProfileSection } from '../../components/ProfileSection'
|
import { ProfileSection } from '../../components/ProfileSection'
|
||||||
import { useAppSelector } from '../../hooks'
|
import { useAppSelector } from '../../hooks'
|
||||||
@ -29,8 +30,11 @@ export const WritePage = () => {
|
|||||||
const blog = data?.blog
|
const blog = data?.blog
|
||||||
const title = data?.blog ? 'Edit blog post' : 'Submit a blog post'
|
const title = data?.blog ? 'Edit blog post' : 'Submit a blog post'
|
||||||
const [content, setContent] = useState(blog?.content || '')
|
const [content, setContent] = useState(blog?.content || '')
|
||||||
|
const [featuredImageUrl, setfeaturedImageUrl] = useState(blog?.image || '')
|
||||||
|
|
||||||
const formRef = useRef<HTMLFormElement>(null)
|
const formRef = useRef<HTMLFormElement>(null)
|
||||||
const editorRef = useRef<EditorRef>(null)
|
const editorRef = useRef<EditorRef>(null)
|
||||||
|
|
||||||
const [showConfirmPopup, setShowConfirmPopup] = useState<boolean>(false)
|
const [showConfirmPopup, setShowConfirmPopup] = useState<boolean>(false)
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
setShowConfirmPopup(true)
|
setShowConfirmPopup(true)
|
||||||
@ -97,12 +101,14 @@ export const WritePage = () => {
|
|||||||
readOnly
|
readOnly
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<InputFieldUncontrolled
|
<InputFieldWithImageUpload
|
||||||
label='Featured Image URL'
|
label='Featured Image URL'
|
||||||
name='image'
|
|
||||||
inputMode='url'
|
inputMode='url'
|
||||||
defaultValue={blog?.image}
|
placeholder='Image URL'
|
||||||
|
name='featuredImageUrl'
|
||||||
|
value={featuredImageUrl}
|
||||||
error={formErrors?.image}
|
error={formErrors?.image}
|
||||||
|
onChange={(_, value) => setfeaturedImageUrl(value)}
|
||||||
/>
|
/>
|
||||||
<InputFieldUncontrolled
|
<InputFieldUncontrolled
|
||||||
label='Summary'
|
label='Summary'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user