File tree 2 files changed +11
-1
lines changed
src/components/WhyDevfiles
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { TextContainer } from 'custom-types' ;
2
2
import { Text , TextContent , TextVariants } from '@patternfly/react-core' ;
3
3
import { GifPlayer } from '@src/components' ;
4
+ import { useWindowDimensions } from '@src/util/client' ;
4
5
import styles from './WhyDevfiles.module.css' ;
5
6
6
7
export interface WhyDevfilesProps {
7
8
whyDevfiles : TextContainer ;
8
9
}
9
10
10
11
export const WhyDevfiles : React . FC < WhyDevfilesProps > = ( props : WhyDevfilesProps ) => {
12
+ const minDemoSize = 480 ;
11
13
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
+ }
12
22
13
23
return (
14
24
< div className = { styles . container } >
@@ -19,7 +29,7 @@ export const WhyDevfiles: React.FC<WhyDevfilesProps> = (props: WhyDevfilesProps)
19
29
< Text className = { styles . bodyText } > { whyDevfiles . body } </ Text >
20
30
</ TextContent >
21
31
< br />
22
- < GifPlayer width = "1920px" height = "1080px" src = "/images/demo.gif" />
32
+ < GifPlayer width = "1920px" height = "1080px" src = { demoFile } />
23
33
</ div >
24
34
) ;
25
35
} ;
You can’t perform that action at this time.
0 commit comments