Fix images not setting properly
This commit is contained in:
parent
b0e37b56c0
commit
328127c55e
@ -1,5 +1,5 @@
|
||||
import { JSX } from "preact";
|
||||
import { createPortal } from "preact/compat";
|
||||
import {JSX} from "preact";
|
||||
import {createPortal} from "preact/compat";
|
||||
|
||||
type Props = {
|
||||
setModalOpen: (open: boolean) => never;
|
||||
@ -9,7 +9,7 @@ type Props = {
|
||||
children: string | JSX.Element | JSX.Element[] | (() => JSX.Element);
|
||||
};
|
||||
|
||||
export const Modal = ({ setModalOpen, title, onSubmit, onSubmitText, children }: Props) => {
|
||||
export const Modal = ({setModalOpen, title, onSubmit, onSubmitText, children}: Props) => {
|
||||
const body = document.querySelector("body");
|
||||
|
||||
return createPortal(
|
||||
@ -34,7 +34,7 @@ export const Modal = ({ setModalOpen, title, onSubmit, onSubmitText, children }:
|
||||
<section class="modal-card-body">{children}</section>
|
||||
{onSubmit && (
|
||||
<footer class="modal-card-foot">
|
||||
<button class="button is-success" onInput={onSubmit}>
|
||||
<button class="button is-success" onClick={onSubmit}>
|
||||
{onSubmitText || "Save"}
|
||||
</button>
|
||||
<button
|
||||
|
@ -16,7 +16,7 @@ export const Author = ({ name, icon, setReminder }: Props) => {
|
||||
class="is-rounded embed_author_url"
|
||||
url={icon}
|
||||
alt="Image for embed author"
|
||||
setImage={(url) => {
|
||||
setImage={(url: string) => {
|
||||
setReminder((reminder) => ({
|
||||
...reminder,
|
||||
embed_author_url: url,
|
||||
|
@ -65,7 +65,12 @@ export const Embed = () => {
|
||||
class="embed_thumbnail_url"
|
||||
url={reminder.embed_thumbnail_url}
|
||||
alt="Square thumbnail embedded image"
|
||||
setImage={() => {}}
|
||||
setImage={(url: string) =>
|
||||
setReminder((reminder: Reminder) => ({
|
||||
...reminder,
|
||||
embed_thumbnail_url: url || null,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
@ -76,7 +81,12 @@ export const Embed = () => {
|
||||
class="embed_image_url"
|
||||
url={reminder.embed_image_url}
|
||||
alt="Large embedded image"
|
||||
setImage={() => {}}
|
||||
setImage={(url: string) =>
|
||||
setReminder((reminder: Reminder) => ({
|
||||
...reminder,
|
||||
embed_image_url: url || null,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
</p>
|
||||
|
||||
|
@ -33,6 +33,7 @@ const ImagePickerModal = ({ setModalOpen, setImage }) => {
|
||||
title={"Enter Image URL"}
|
||||
onSubmit={() => {
|
||||
setImage(value);
|
||||
setModalOpen(false);
|
||||
}}
|
||||
onSubmitText={"Save"}
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user