Skip to content

Commit d53ac60

Browse files
committed
Add logo
1 parent 56a5b0b commit d53ac60

File tree

3 files changed

+68
-14
lines changed

3 files changed

+68
-14
lines changed

docs/src/components/Hero/StartScreen/index.tsx

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
import React from 'react';
22
import styles from './styles.module.css';
33
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';
46

57
const StartScreen = () => {
8+
const { windowWidth } = useScreenSize();
9+
610
return (
711
<section className={styles.hero}>
812
<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 />}
1825
</div>
1926
<div className={styles.lowerHeading}>
2027
<div className={styles.buttonContainer}>

docs/src/components/Hero/StartScreen/styles.module.css

+20-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,22 @@
55
}
66

77
.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;
924
}
1025

1126
.headingLabel {
@@ -32,12 +47,12 @@
3247
letter-spacing: var(--swm-heading-letter-spacing-bigger);
3348

3449
margin-top: 3rem;
35-
margin-bottom: 5.5rem;
36-
width: 70%;
50+
width: 80%;
3751
color: var(--swm-landing-heading);
3852
}
3953

4054
.buttonContainer {
55+
margin-top: 5rem;
4156
display: flex;
4257
justify-content: flex-start;
4358
}
@@ -54,8 +69,8 @@
5469
}
5570

5671
@media (max-width: 420px) {
57-
.heading {
58-
margin-top: 9.5rem;
72+
.heading {
73+
margin-top: 6rem;
5974
}
6075
.headingLabel {
6176
font-size: 26px;

docs/src/hooks/useScreenSize.tsx

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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;

0 commit comments

Comments
 (0)