Skip to content

Commit 93624d0

Browse files
added screen resolution and color to home page to make resizing easier to test and visually understand (#729)
1 parent 1ffb647 commit 93624d0

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

src/pages/Home.tsx

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,27 @@ import {
77
IonTitle,
88
IonToolbar,
99
} from '@ionic/react';
10-
import React from 'react';
10+
import React, { useEffect, useState } from 'react';
1111

1212
const Home: React.FC = () => {
13+
const [count, setCount] = useState(0);
14+
const [dimensions, setDimensions] = useState({
15+
width: window.innerWidth,
16+
height: window.innerHeight,
17+
});
18+
19+
useEffect(() => {
20+
const handleResize = () => {
21+
setDimensions({
22+
width: window.innerWidth,
23+
height: window.innerHeight,
24+
});
25+
};
26+
27+
window.addEventListener('resize', handleResize);
28+
return () => window.removeEventListener('resize', handleResize);
29+
}, []);
30+
1331
return (
1432
<IonPage>
1533
<IonHeader>
@@ -20,12 +38,28 @@ const Home: React.FC = () => {
2038
<IonTitle>Home</IonTitle>
2139
</IonToolbar>
2240
</IonHeader>
23-
<IonContent>
24-
<p>Welcome to the Capacitor Test App.</p>
25-
<p>
26-
This app was created to test and develop Capacitor core and plugins.
27-
To test plugins, open the side menu and navigate to the plugin's page!
28-
</p>
41+
<IonContent style={{ '--background': '#a7fc7aff' }}>
42+
<div className="container">
43+
<p>Welcome to the Capacitor Test App.</p>
44+
<p>
45+
This app was created to test and develop Capacitor core and plugins.
46+
To test plugins, open the side menu and navigate to the plugin's
47+
page!
48+
</p>
49+
<div
50+
style={{
51+
fontSize: '30px',
52+
fontFamily: 'monospace',
53+
}}>
54+
App Resolution: {dimensions.width} × {dimensions.height}
55+
</div>
56+
<h1>Counter</h1>
57+
<div className="counter">
58+
<button onClick={() => setCount(count - 1)}>-</button>
59+
<span>{count}</span>
60+
<button onClick={() => setCount(count + 1)}>+</button>
61+
</div>
62+
</div>
2963
</IonContent>
3064
</IonPage>
3165
);

0 commit comments

Comments
 (0)