|
|
@ -5,14 +5,15 @@ import { |
|
|
|
PowerOffOutlined as PowerOffOutlinedIcon, |
|
|
|
PowerOffOutlined as PowerOffOutlinedIcon, |
|
|
|
} from '@mui/icons-material'; |
|
|
|
} from '@mui/icons-material'; |
|
|
|
|
|
|
|
|
|
|
|
import { GREY } from '../../lib/consts/DEFAULT_THEME'; |
|
|
|
import { BORDER_RADIUS, GREY } from '../../lib/consts/DEFAULT_THEME'; |
|
|
|
|
|
|
|
|
|
|
|
import IconButton from '../IconButton'; |
|
|
|
import IconButton from '../IconButton'; |
|
|
|
import { Panel, PanelHeader } from '../Panels'; |
|
|
|
import { InnerPanel, InnerPanelHeader, Panel, PanelHeader } from '../Panels'; |
|
|
|
import { HeaderText } from '../Text'; |
|
|
|
import { BodyText, HeaderText } from '../Text'; |
|
|
|
|
|
|
|
|
|
|
|
type PreviewOptionalProps = { |
|
|
|
type PreviewOptionalProps = { |
|
|
|
isShowControls?: boolean; |
|
|
|
isShowControls?: boolean; |
|
|
|
|
|
|
|
isUseInnerPanel?: boolean; |
|
|
|
setMode?: Dispatch<SetStateAction<boolean>> | null; |
|
|
|
setMode?: Dispatch<SetStateAction<boolean>> | null; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -23,11 +24,40 @@ type PreviewProps = PreviewOptionalProps & { |
|
|
|
|
|
|
|
|
|
|
|
const PREVIEW_DEFAULT_PROPS: Required<PreviewOptionalProps> = { |
|
|
|
const PREVIEW_DEFAULT_PROPS: Required<PreviewOptionalProps> = { |
|
|
|
isShowControls: true, |
|
|
|
isShowControls: true, |
|
|
|
|
|
|
|
isUseInnerPanel: false, |
|
|
|
setMode: null, |
|
|
|
setMode: null, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const PreviewPanel: FC<{ isUseInnerPanel: boolean }> = ({ |
|
|
|
|
|
|
|
children, |
|
|
|
|
|
|
|
isUseInnerPanel, |
|
|
|
|
|
|
|
}) => |
|
|
|
|
|
|
|
isUseInnerPanel ? ( |
|
|
|
|
|
|
|
<InnerPanel>{children}</InnerPanel> |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
<Panel>{children}</Panel> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const PreviewPanelHeader: FC<{ isUseInnerPanel: boolean; text: string }> = ({ |
|
|
|
|
|
|
|
children, |
|
|
|
|
|
|
|
isUseInnerPanel, |
|
|
|
|
|
|
|
text, |
|
|
|
|
|
|
|
}) => |
|
|
|
|
|
|
|
isUseInnerPanel ? ( |
|
|
|
|
|
|
|
<InnerPanelHeader> |
|
|
|
|
|
|
|
<BodyText text={text} /> |
|
|
|
|
|
|
|
{children} |
|
|
|
|
|
|
|
</InnerPanelHeader> |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
<PanelHeader> |
|
|
|
|
|
|
|
<HeaderText text={text} /> |
|
|
|
|
|
|
|
{children} |
|
|
|
|
|
|
|
</PanelHeader> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const Preview: FC<PreviewProps> = ({ |
|
|
|
const Preview: FC<PreviewProps> = ({ |
|
|
|
isShowControls = PREVIEW_DEFAULT_PROPS.isShowControls, |
|
|
|
isShowControls = PREVIEW_DEFAULT_PROPS.isShowControls, |
|
|
|
|
|
|
|
isUseInnerPanel = PREVIEW_DEFAULT_PROPS.isUseInnerPanel, |
|
|
|
serverName, |
|
|
|
serverName, |
|
|
|
setMode, |
|
|
|
setMode, |
|
|
|
uuid, |
|
|
|
uuid, |
|
|
@ -55,10 +85,11 @@ const Preview: FC<PreviewProps> = ({ |
|
|
|
}, [uuid]); |
|
|
|
}, [uuid]); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Panel> |
|
|
|
<PreviewPanel isUseInnerPanel={isUseInnerPanel}> |
|
|
|
<PanelHeader> |
|
|
|
<PreviewPanelHeader |
|
|
|
<HeaderText text={`Server: ${serverName}`} /> |
|
|
|
isUseInnerPanel={isUseInnerPanel} |
|
|
|
</PanelHeader> |
|
|
|
text={`Server: ${serverName}`} |
|
|
|
|
|
|
|
/> |
|
|
|
<Box |
|
|
|
<Box |
|
|
|
sx={{ |
|
|
|
sx={{ |
|
|
|
display: 'flex', |
|
|
|
display: 'flex', |
|
|
@ -74,6 +105,7 @@ const Preview: FC<PreviewProps> = ({ |
|
|
|
component="span" |
|
|
|
component="span" |
|
|
|
onClick={() => setMode?.call(null, false)} |
|
|
|
onClick={() => setMode?.call(null, false)} |
|
|
|
sx={{ |
|
|
|
sx={{ |
|
|
|
|
|
|
|
borderRadius: BORDER_RADIUS, |
|
|
|
color: GREY, |
|
|
|
color: GREY, |
|
|
|
padding: 0, |
|
|
|
padding: 0, |
|
|
|
}} |
|
|
|
}} |
|
|
@ -92,7 +124,6 @@ const Preview: FC<PreviewProps> = ({ |
|
|
|
<PowerOffOutlinedIcon |
|
|
|
<PowerOffOutlinedIcon |
|
|
|
sx={{ |
|
|
|
sx={{ |
|
|
|
height: '100%', |
|
|
|
height: '100%', |
|
|
|
padding: 0, |
|
|
|
|
|
|
|
width: '100%', |
|
|
|
width: '100%', |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
@ -107,7 +138,7 @@ const Preview: FC<PreviewProps> = ({ |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
)} |
|
|
|
)} |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Panel> |
|
|
|
</PreviewPanel> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|