fix(striker-ui): enable end adnorment in Preview title

main
Tsu-ba-me 3 years ago
parent d81b0e54d7
commit 03e04a0a07
  1. 18
      striker-ui/components/Display/Preview.tsx

@ -1,4 +1,11 @@
import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react'; import {
Dispatch,
FC,
ReactNode,
SetStateAction,
useEffect,
useState,
} from 'react';
import { Box, IconButton as MUIIconButton } from '@mui/material'; import { Box, IconButton as MUIIconButton } from '@mui/material';
import { import {
DesktopWindows as DesktopWindowsIcon, DesktopWindows as DesktopWindowsIcon,
@ -14,6 +21,7 @@ import { BodyText, HeaderText } from '../Text';
type PreviewOptionalProps = { type PreviewOptionalProps = {
externalPreview?: string; externalPreview?: string;
headerEndAdornment?: ReactNode;
isExternalPreviewStale?: boolean; isExternalPreviewStale?: boolean;
isFetchPreview?: boolean; isFetchPreview?: boolean;
isShowControls?: boolean; isShowControls?: boolean;
@ -28,6 +36,7 @@ type PreviewProps = PreviewOptionalProps & {
const PREVIEW_DEFAULT_PROPS: Required<PreviewOptionalProps> = { const PREVIEW_DEFAULT_PROPS: Required<PreviewOptionalProps> = {
externalPreview: '', externalPreview: '',
headerEndAdornment: null,
isExternalPreviewStale: false, isExternalPreviewStale: false,
isFetchPreview: true, isFetchPreview: true,
isShowControls: true, isShowControls: true,
@ -64,6 +73,7 @@ const PreviewPanelHeader: FC<{ isUseInnerPanel: boolean; text: string }> = ({
const Preview: FC<PreviewProps> = ({ const Preview: FC<PreviewProps> = ({
externalPreview = PREVIEW_DEFAULT_PROPS.externalPreview, externalPreview = PREVIEW_DEFAULT_PROPS.externalPreview,
headerEndAdornment,
isExternalPreviewStale = PREVIEW_DEFAULT_PROPS.isExternalPreviewStale, isExternalPreviewStale = PREVIEW_DEFAULT_PROPS.isExternalPreviewStale,
isFetchPreview = PREVIEW_DEFAULT_PROPS.isFetchPreview, isFetchPreview = PREVIEW_DEFAULT_PROPS.isFetchPreview,
isShowControls = PREVIEW_DEFAULT_PROPS.isShowControls, isShowControls = PREVIEW_DEFAULT_PROPS.isShowControls,
@ -106,8 +116,10 @@ const Preview: FC<PreviewProps> = ({
<PreviewPanel isUseInnerPanel={isUseInnerPanel}> <PreviewPanel isUseInnerPanel={isUseInnerPanel}>
<PreviewPanelHeader <PreviewPanelHeader
isUseInnerPanel={isUseInnerPanel} isUseInnerPanel={isUseInnerPanel}
text={`Server: ${serverName}`} text={`${serverName}`}
/> >
{headerEndAdornment}
</PreviewPanelHeader>
<Box <Box
sx={{ sx={{
display: 'flex', display: 'flex',

Loading…
Cancel
Save