From e4d5432d5d61ea1e2ce1c35d51b9eade74931ba9 Mon Sep 17 00:00:00 2001 From: Adrian Krzeminski Date: Thu, 9 May 2024 16:16:07 +0200 Subject: [PATCH] Fix formatting --- src/components/FusionEmbed/index.tsx | 141 +++++++++++++-------------- 1 file changed, 68 insertions(+), 73 deletions(-) diff --git a/src/components/FusionEmbed/index.tsx b/src/components/FusionEmbed/index.tsx index 881b073b..fba40322 100644 --- a/src/components/FusionEmbed/index.tsx +++ b/src/components/FusionEmbed/index.tsx @@ -2,81 +2,76 @@ import React, { useState } from 'react'; import styles from './styles.module.css'; export interface FusionEmbedProps { - url: string; - embedTitle: string; - loading?: 'lazy' | 'eager'; - img?: string; - alt?: string; - img_width?: number; - img_height?: number; - } + url: string; + embedTitle: string; + loading?: 'lazy' | 'eager'; + img?: string; + alt?: string; + img_width?: number; + img_height?: number; +} -export default function FusionEmbed( props: FusionEmbedProps ) { +export default function FusionEmbed(props: FusionEmbedProps) { + const url = props.url; + const loading = props.loading || 'lazy'; + const img = props.img || '/img/misc/cube.webp'; + const alt = props.alt || 'placeholder for 3D model'; + const img_width = props.img_width || 1920; + const img_height = props.img_height || 1080; + const title = props.embedTitle || '3D CAD model'; + const [buttonClicked, setButtonClicked] = useState(false); + const [imageHide, setImageHide] = useState(false); + const [iframeLoaded, setiframeLoaded] = useState(false); - const url = props.url; - const loading = props.loading || 'lazy'; - const img = props.img || '/img/misc/cube.webp'; - const alt = props.alt || 'placeholder for 3D model'; - const img_width = props.img_width || 1920; - const img_height = props.img_height || 1080; - const title = props.embedTitle || "3D CAD model"; - const [buttonClicked, setButtonClicked] = useState(false); - const [imageHide, setImageHide] = useState(false); - const [iframeLoaded, setiframeLoaded] = useState(false); + if (props.img) { + if (!props.img_width) throw 'No image width specified!'; + if (!props.img_height) throw 'No image height specified!'; + } - if( props.img ) { - if( !props.img_width ) - throw 'No image width specified!' - if( !props.img_height ) - throw 'No image height specified!' - } + const handleButtonClick = () => { + setButtonClicked(true); + setImageHide(false); + }; - - const handleButtonClick = () => { - setButtonClicked(true); - setImageHide(false); - }; + const handleIframeLoad = () => { + setTimeout(() => { + setiframeLoaded(true); + }, 1000); + setTimeout(() => { + setImageHide(true); + }, 2000); + }; - const handleIframeLoad = () => { - setTimeout(() => { - setiframeLoaded(true); - }, 1000); - setTimeout(() => { - setImageHide(true); - }, 2000); - } - - return ( -
-
- {buttonClicked && ( -