Skip to content

Commit f459948

Browse files
committed
update
1 parent df05b65 commit f459948

File tree

5 files changed

+71
-38
lines changed

5 files changed

+71
-38
lines changed

APP.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { useState } from 'react';
2+
3+
export default function MyApp() {
4+
const [count, setCount] = useState(0);
5+
6+
function handleClick() {
7+
setCount(count + 1);
8+
}
9+
10+
return (
11+
<div>
12+
<h1>Counters that update together</h1>
13+
<MyButton count={count} onClick={handleClick} />
14+
<MyButton count={count} onClick={handleClick} />
15+
</div>
16+
);
17+
}
18+
19+
function MyButton({ count, onClick }) {
20+
return (
21+
<button onClick={onClick}>
22+
Clicked {count} times
23+
</button>
24+
);
25+
}

index.html

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,8 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>danielchen3</title>
7-
<style>
8-
body {
9-
font-family: Arial, sans-serif;
10-
text-align: center;
11-
margin: 50px;
12-
background-color: #f9f9f9;
13-
}
14-
h1 {
15-
color: #4CAF50;
16-
}
17-
p {
18-
font-size: 18px;
19-
color: #555;
20-
}
21-
.button-container {
22-
margin-top: 20px;
23-
}
24-
button {
25-
background-color: #4CAF50;
26-
color: white;
27-
border: none;
28-
padding: 10px 20px;
29-
font-size: 16px;
30-
border-radius: 5px;
31-
cursor: pointer;
32-
margin: 10px;
33-
transition: background-color 0.3s, transform 0.2s;
34-
}
35-
button:hover {
36-
background-color: linear-gradient(90deg, #45a049, #32a89f);
37-
transform: scale(1.05);
38-
}
39-
a {
40-
text-decoration: none;
41-
}
42-
</style>
7+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
8+
<link href="style.css" rel="stylesheet" />
439
</head>
4410
<body>
4511
<h1>Welcome to My Github</h1>

style.css

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* html {
2+
background-color: #00539f;
3+
} */
4+
5+
body {
6+
font-family: Georgia, 'Times New Roman', Times, serif;
7+
text-align: center;
8+
margin: 50px;
9+
background-color: #f9f9f9;
10+
}
11+
h1 {
12+
text-shadow: 1px 1px 1px black;
13+
color: #4CAF50;
14+
}
15+
p::first-line {
16+
font-size: 18px;
17+
color: #555;
18+
}
19+
.button-container {
20+
margin-top: 20px;
21+
}
22+
button {
23+
background-color: #4CAF50;
24+
color: white;
25+
border: 20px;
26+
padding: 10px 20px;
27+
font-size: 16px;
28+
border-radius: 5px;
29+
cursor: pointer;
30+
margin: 10px;
31+
transition: background-color 0.3s, transform 0.2s;
32+
}
33+
button:hover {
34+
background-color: linear-gradient(90deg, #45a049, #32a89f);
35+
transform: scale(1.05);
36+
}
37+
a {
38+
text-decoration: none;
39+
}

usa_map/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h1>Welcome to USA ALERT</h1>
1212
<p>Let's alert America!</p>
1313

1414
<div class="map-container">
15-
<object id="usaMap" data="usa_map.svg" type="image/svg+xml" style="width: 60%; max-width: auto; height: auto; border: 1px solid #ddd;"></object>
15+
<object id="usaMap" data="usa_map.svg" type="image/svg+xml"></object>
1616
<div id="stateInfo"></div>
1717
</div>
1818

usa_map/sty.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ p {
2323
.map-container {
2424
display: flex;
2525
gap: 20px;
26+
overflow: auto; /* 添加滚动条 */
2627
}
2728

2829
.tooltip {
@@ -53,9 +54,11 @@ button {
5354

5455
#usaMap {
5556
width: 60%;
56-
height: 80vh;
5757
min-height: 400px;
5858
border: 1px solid #ddd;
59+
overflow-y: scroll;
60+
overflow-x: scroll;
61+
object-fit: contain; /* 保持 SVG 比例缩放 */
5962
}
6063

6164
#stateInfo {

0 commit comments

Comments
 (0)