File tree 3 files changed +68
-14
lines changed
components/Hero/StartScreen
3 files changed +68
-14
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import styles from './styles.module.css' ;
3
3
import HomepageButton from '@site/src/components/HomepageButton' ;
4
+ import useScreenSize from '@site/src/hooks/useScreenSize' ;
5
+ import Logo from '@site/static/img/logo-hero.svg' ;
4
6
5
7
const StartScreen = ( ) => {
8
+ const { windowWidth } = useScreenSize ( ) ;
9
+
6
10
return (
7
11
< section className = { styles . hero } >
8
12
< div className = { styles . heading } >
9
- < div >
10
- < h1 className = { styles . headingLabel } >
11
- < span > React Native</ span >
12
- < span > ExecuTorch</ span >
13
- </ h1 >
14
- < h2 className = { styles . subheadingLabel } >
15
- Declarative way to run AI models in React Native on device, powered
16
- by ExecuTorch.
17
- </ h2 >
13
+ < div className = { styles . subheadingContainer } >
14
+ < div >
15
+ < h1 className = { styles . headingLabel } >
16
+ < span > React Native</ span >
17
+ < span > ExecuTorch</ span >
18
+ </ h1 >
19
+ < h2 className = { styles . subheadingLabel } >
20
+ Declarative way to run AI models in React Native on device,
21
+ powered by ExecuTorch.
22
+ </ h2 >
23
+ </ div >
24
+ { windowWidth > 768 && < Logo /> }
18
25
</ div >
19
26
< div className = { styles . lowerHeading } >
20
27
< div className = { styles . buttonContainer } >
Original file line number Diff line number Diff line change 5
5
}
6
6
7
7
.heading {
8
- margin-top : 11.25rem ;
8
+ width : 100% ;
9
+ margin-top : 8rem ;
10
+ }
11
+
12
+ .subheadingContainer {
13
+ width : 100% ;
14
+ display : flex;
15
+ flex-direction : row;
16
+ justify-content : space-between;
17
+ align-items : center;
18
+ }
19
+
20
+ .subheadingContainer svg {
21
+ height : 100% ;
22
+ width : 100% ;
23
+ max-width : 220px ;
9
24
}
10
25
11
26
.headingLabel {
32
47
letter-spacing : var (--swm-heading-letter-spacing-bigger );
33
48
34
49
margin-top : 3rem ;
35
- margin-bottom : 5.5rem ;
36
- width : 70% ;
50
+ width : 80% ;
37
51
color : var (--swm-landing-heading );
38
52
}
39
53
40
54
.buttonContainer {
55
+ margin-top : 5rem ;
41
56
display : flex;
42
57
justify-content : flex-start;
43
58
}
54
69
}
55
70
56
71
@media (max-width : 420px ) {
57
- .heading {
58
- margin-top : 9.5 rem ;
72
+ .heading {
73
+ margin-top : 6 rem ;
59
74
}
60
75
.headingLabel {
61
76
font-size : 26px ;
Original file line number Diff line number Diff line change
1
+ import React , { useEffect , useState } from 'react' ;
2
+
3
+ /*
4
+ * Caution - read before use!
5
+ * As this hook uses innerWidth prop, which belongs to the window object,
6
+ * it requires to use the viewport. Thus, building the production build of the
7
+ * application may fail, as the Docusaurus is using SSR to serve it.
8
+ * Remember to verify if user can use the viewport by using
9
+ * `ExecutionEnvironment.canUseViewport` method, `<BrowserOnly>` component or
10
+ * `useIsBrowser` hook.
11
+ */
12
+ const useScreenSize = ( ) => {
13
+ const [ windowWidth , setWindowWidth ] = useState ( window . innerWidth ) ;
14
+
15
+ useEffect ( ( ) => {
16
+ const handleWindowResize = ( ) => {
17
+ setWindowWidth ( window . innerWidth ) ;
18
+ } ;
19
+
20
+ window . addEventListener ( 'resize' , handleWindowResize ) ;
21
+
22
+ return ( ) => {
23
+ window . removeEventListener ( 'resize' , handleWindowResize ) ;
24
+ } ;
25
+ } , [ ] ) ;
26
+
27
+ return {
28
+ windowWidth,
29
+ } ;
30
+ } ;
31
+
32
+ export default useScreenSize ;
You can’t perform that action at this time.
0 commit comments