diff --git a/web/components/action-buttons/ActionButton.tsx b/web/components/action-buttons/ActionButton.tsx index cd5a4496e..41002519f 100644 --- a/web/components/action-buttons/ActionButton.tsx +++ b/web/components/action-buttons/ActionButton.tsx @@ -1,4 +1,6 @@ import { Button } from 'antd'; +import { useState } from 'react'; +import Modal from '../ui/Modal/Modal'; import { ExternalAction } from '../interfaces/external-action.interface'; import s from './ActionButton.module.scss'; @@ -7,13 +9,35 @@ interface Props { } export default function ActionButton(props: Props) { + const [showModal, setShowModal] = useState(false); const { action } = props; const { url, title, description, icon, color, openExternally } = action; + const buttonClicked = () => { + if (openExternally) { + window.open(url, '_blank'); + } else { + setShowModal(true); + } + }; + return ( - + <> + + setShowModal(false)} + /> + ); } diff --git a/web/components/ui/Content/Content.tsx b/web/components/ui/Content/Content.tsx index dd18b5381..9ff9942da 100644 --- a/web/components/ui/Content/Content.tsx +++ b/web/components/ui/Content/Content.tsx @@ -49,7 +49,7 @@ export default function ContentComponent() { description: 'Example button description', icon: 'https://owncast.online/images/logo.svg', color: '#5232c8', - openExternally: true, + openExternally: false, }, ]; diff --git a/web/components/ui/Modal/Modal.module.scss b/web/components/ui/Modal/Modal.module.scss new file mode 100644 index 000000000..0dd02e4a5 --- /dev/null +++ b/web/components/ui/Modal/Modal.module.scss @@ -0,0 +1,11 @@ +.spinner { + position: absolute; + top: 50%; + left: 50%; +} + +.content { + display: block; + height: 100%; + padding: 2vw; +} \ No newline at end of file diff --git a/web/components/ui/Modal/Modal.tsx b/web/components/ui/Modal/Modal.tsx new file mode 100644 index 000000000..11f00ef39 --- /dev/null +++ b/web/components/ui/Modal/Modal.tsx @@ -0,0 +1,74 @@ +import { Spin, Skeleton, Modal as AntModal } from 'antd'; +import React, { ReactNode, useState } from 'react'; +import s from './Modal.module.scss'; + +interface Props { + title: string; + url?: string; + visible: boolean; + handleOk?: () => void; + handleCancel?: () => void; + afterClose?: () => void; + children?: ReactNode; +} + +export default function Modal(props: Props) { + const { title, url, visible, handleOk, handleCancel, afterClose, children } = props; + const [loading, setLoading] = useState(!!url); + + const modalStyle = { + padding: '0px', + height: '80vh', + }; + + console.log(url); + const iframe = url && ( +