Skip to content

Commit ae91b10

Browse files
demo now shows as static image when viewed on mobile device.
Signed-off-by: Michael Valdron <[email protected]>
1 parent 87cc21d commit ae91b10

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

public/images/demo.png

212 KB
Loading

src/components/WhyDevfiles/WhyDevfiles.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
import { TextContainer } from 'custom-types';
22
import { Text, TextContent, TextVariants } from '@patternfly/react-core';
33
import { GifPlayer } from '@src/components';
4+
import { useWindowDimensions } from '@src/util/client';
45
import styles from './WhyDevfiles.module.css';
56

67
export interface WhyDevfilesProps {
78
whyDevfiles: TextContainer;
89
}
910

1011
export const WhyDevfiles: React.FC<WhyDevfilesProps> = (props: WhyDevfilesProps) => {
12+
const minDemoSize = 480;
1113
const { whyDevfiles } = props;
14+
const { height, width } = useWindowDimensions();
15+
let demoFile: string;
16+
17+
if (width !== undefined && height !== undefined && Math.min(height, width) < minDemoSize) {
18+
demoFile = '/images/demo.png';
19+
} else {
20+
demoFile = '/images/demo.gif';
21+
}
1222

1323
return (
1424
<div className={styles.container}>
@@ -19,7 +29,7 @@ export const WhyDevfiles: React.FC<WhyDevfilesProps> = (props: WhyDevfilesProps)
1929
<Text className={styles.bodyText}>{whyDevfiles.body}</Text>
2030
</TextContent>
2131
<br />
22-
<GifPlayer width="1920px" height="1080px" src="/images/demo.gif" />
32+
<GifPlayer width="1920px" height="1080px" src={demoFile} />
2333
</div>
2434
);
2535
};

0 commit comments

Comments
 (0)