Skip to content

Commit 30d23d8

Browse files
authored
Tweaks to Preview Max Height (#2012)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
1 parent 42deb99 commit 30d23d8

File tree

1 file changed

+66
-51
lines changed

1 file changed

+66
-51
lines changed

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/Preview/PreviewFileContent.tsx

Lines changed: 66 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -96,59 +96,74 @@ const PreviewFile = ({
9696
<LinearProgress />
9797
</Grid>
9898
)}
99-
{objectType === "video" && (
100-
<video
101-
style={{ width: "100%", height: "auto" }}
102-
autoPlay={true}
103-
controls={true}
104-
muted={false}
105-
playsInline={true}
106-
onPlay={iframeLoaded}
107-
>
108-
<source src={path} type="video/mp4" />
109-
</video>
110-
)}
111-
{objectType === "audio" && (
112-
<audio
113-
style={{ width: "100%", height: "auto" }}
114-
autoPlay={true}
115-
controls={true}
116-
muted={false}
117-
playsInline={true}
118-
onPlay={iframeLoaded}
119-
>
120-
<source src={path} type="audio/mpeg" />
121-
</audio>
122-
)}
123-
{objectType === "image" && (
124-
<img
125-
style={{ width: "100%", height: "auto" }}
126-
src={path}
127-
alt={"preview"}
128-
onLoad={iframeLoaded}
129-
/>
130-
)}
131-
{objectType !== "video" &&
132-
objectType !== "audio" &&
133-
objectType !== "image" && (
134-
<div
135-
className={clsx(classes.iframeBase, {
136-
[classes.iframeHidden]: loading,
137-
})}
99+
<div style={{ textAlign: "center" }}>
100+
{objectType === "video" && (
101+
<video
102+
style={{
103+
width: "auto",
104+
height: "auto",
105+
maxWidth: "calc(100vw - 100px)",
106+
maxHeight: "calc(100vh - 200px)",
107+
}}
108+
autoPlay={true}
109+
controls={true}
110+
muted={false}
111+
playsInline={true}
112+
onPlay={iframeLoaded}
138113
>
139-
<iframe
140-
src={path}
141-
title="File Preview"
142-
allowTransparency
143-
className={`${classes.iframeContainer} ${
144-
isFullscreen ? "fullHeight" : objectType
145-
}`}
146-
onLoad={iframeLoaded}
147-
>
148-
File couldn't be loaded. Please try Download instead
149-
</iframe>
150-
</div>
114+
<source src={path} type="video/mp4" />
115+
</video>
151116
)}
117+
{objectType === "audio" && (
118+
<audio
119+
style={{
120+
width: "100%",
121+
height: "auto",
122+
}}
123+
autoPlay={true}
124+
controls={true}
125+
muted={false}
126+
playsInline={true}
127+
onPlay={iframeLoaded}
128+
>
129+
<source src={path} type="audio/mpeg" />
130+
</audio>
131+
)}
132+
{objectType === "image" && (
133+
<img
134+
style={{
135+
width: "auto",
136+
height: "auto",
137+
maxWidth: "100vw",
138+
maxHeight: "100vh",
139+
}}
140+
src={path}
141+
alt={"preview"}
142+
onLoad={iframeLoaded}
143+
/>
144+
)}
145+
{objectType !== "video" &&
146+
objectType !== "audio" &&
147+
objectType !== "image" && (
148+
<div
149+
className={clsx(classes.iframeBase, {
150+
[classes.iframeHidden]: loading,
151+
})}
152+
>
153+
<iframe
154+
src={path}
155+
title="File Preview"
156+
allowTransparency
157+
className={`${classes.iframeContainer} ${
158+
isFullscreen ? "fullHeight" : objectType
159+
}`}
160+
onLoad={iframeLoaded}
161+
>
162+
File couldn't be loaded. Please try Download instead
163+
</iframe>
164+
</div>
165+
)}
166+
</div>
152167
</Fragment>
153168
);
154169
};

0 commit comments

Comments
 (0)