edit switch ctr
This commit is contained in:
parent
30003edea8
commit
76595257e2
@ -142,9 +142,11 @@ export default function Home() {
|
|||||||
}
|
}
|
||||||
,{" "}
|
,{" "}
|
||||||
{systemUsed == "metric"
|
{systemUsed == "metric"
|
||||||
? convertTime(weatherData.dt, weatherData.timezone)[0].split(
|
? parseInt(
|
||||||
":"
|
convertTime(weatherData.dt, weatherData.timezone)[0].split(
|
||||||
)[0]
|
":"
|
||||||
|
)[0]
|
||||||
|
)
|
||||||
: timeToAMPM(
|
: timeToAMPM(
|
||||||
convertTime(weatherData.dt, weatherData.timezone)[0]
|
convertTime(weatherData.dt, weatherData.timezone)[0]
|
||||||
).split(":")[0]}
|
).split(":")[0]}
|
||||||
@ -157,7 +159,6 @@ export default function Home() {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className={styles.searchInput}
|
className={styles.searchInput}
|
||||||
// defaultValue="Search a city..."
|
|
||||||
onFocus={(e) => (e.target.value = "")}
|
onFocus={(e) => (e.target.value = "")}
|
||||||
onChange={(e) => setInput(e.target.value)}
|
onChange={(e) => setInput(e.target.value)}
|
||||||
onKeyDown={(e) => something(e)}
|
onKeyDown={(e) => something(e)}
|
||||||
@ -244,10 +245,17 @@ export default function Home() {
|
|||||||
<div>
|
<div>
|
||||||
<h1>
|
<h1>
|
||||||
{systemUsed == "metric"
|
{systemUsed == "metric"
|
||||||
? convertTime(
|
? `${parseInt(
|
||||||
weatherData.sys.sunrise,
|
convertTime(
|
||||||
weatherData.timezone
|
weatherData.sys.sunrise,
|
||||||
)[0]
|
weatherData.timezone
|
||||||
|
)[0].split(":")[0]
|
||||||
|
)}:${
|
||||||
|
convertTime(
|
||||||
|
weatherData.sys.sunrise,
|
||||||
|
weatherData.timezone
|
||||||
|
)[0].split(":")[1]
|
||||||
|
}`
|
||||||
: timeToAMPM(
|
: timeToAMPM(
|
||||||
convertTime(
|
convertTime(
|
||||||
weatherData.sys.sunrise,
|
weatherData.sys.sunrise,
|
||||||
@ -305,9 +313,22 @@ export default function Home() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className={styles.switchBox}>
|
||||||
<p onClick={changeSystem}>Metric System</p>
|
<p
|
||||||
<p onClick={changeSystem}>Imperial System</p>
|
className={styles.switch}
|
||||||
|
style={{ color: systemUsed == "metric" ? "green" : "black" }}
|
||||||
|
onClick={changeSystem}
|
||||||
|
>
|
||||||
|
Metric System
|
||||||
|
</p>
|
||||||
|
<p
|
||||||
|
className={styles.switch}
|
||||||
|
style={{ color: systemUsed == "metric" ? "black" : "green" }}
|
||||||
|
onClick={changeSystem}
|
||||||
|
>
|
||||||
|
Imperial System
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
grid-template-columns: 1fr 1fr 1fr;
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.statsCard {
|
.statsCard {
|
||||||
@ -77,6 +78,16 @@
|
|||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.switchBox {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch {
|
||||||
|
margin: 0 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 950px) {
|
@media only screen and (max-width: 950px) {
|
||||||
.wrapper {
|
.wrapper {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user