import { Center, createStyles, Stack, Title, Text, Container } from '@mantine/core'; import { IconBrowser, IconUnlink } from '@tabler/icons-react'; import { useTranslation } from 'next-i18next'; import { defineWidget } from '../helper'; import { IWidget } from '../widgets'; const definition = defineWidget({ id: 'iframe', icon: IconBrowser, gridstack: { maxHeight: 12, maxWidth: 12, minHeight: 1, minWidth: 1, }, options: { embedUrl: { type: 'text', defaultValue: '', }, allowFullScreen: { type: 'switch', defaultValue: false, }, }, component: IFrameTile, }); export type IIFrameWidget = IWidget<(typeof definition)['id'], typeof definition>; interface IFrameTileProps { widget: IIFrameWidget; } function IFrameTile({ widget }: IFrameTileProps) { const { t } = useTranslation('modules/iframe'); const { classes } = useStyles(); if (!widget.properties.embedUrl) { return (
{t('card.errors.noUrl.title')} {t('card.errors.noUrl.text')}
); } return ( ); } const useStyles = createStyles(({ radius }) => ({ iframe: { borderRadius: radius.sm, width: '100%', height: '100%', border: 'none', background: 'none', backgroundColor: 'transparent', }, })); export default definition;