This commit is contained in:
parent
582af2ba98
commit
e8e924b595
14 changed files with 406 additions and 292 deletions
|
@ -1,28 +1,43 @@
|
|||
import { useState } from 'preact/hooks';
|
||||
import { ChevronLeft, ChevronRight } from 'lucide-preact';
|
||||
import { ChevronLeft, ChevronRight } from "lucide-preact";
|
||||
import { useState } from "preact/hooks";
|
||||
|
||||
export default () => {
|
||||
const [wttrDesc, setWttrDesc] = useState<string>("Loading...");
|
||||
const [wttrDesc, setWttrDesc] = useState<string>("Loading...");
|
||||
|
||||
fetch(`https://wttr.in/${localStorage.getItem("location") || ""}?format=%t%20with%20%C%c&m`)
|
||||
.then(res => res.text())
|
||||
.then(desc => {
|
||||
setWttrDesc(desc.trim());
|
||||
})
|
||||
fetch(
|
||||
`https://wttr.in/${localStorage.getItem("location") || ""}?format=%t%20with%20%C%c&m`,
|
||||
)
|
||||
.then((res) => res.text())
|
||||
.then((desc) => {
|
||||
setWttrDesc(desc.trim());
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<nav class="navbar shadow fixed-top" style="background-color: var(--bs-content-bg); border-bottom: var(--bs-border-width) solid var(--bs-content-border-color);">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-brand">
|
||||
{wttrDesc}
|
||||
</div>
|
||||
<div class="d-flex hstack gap-2">
|
||||
<button type="button" class="btn btn-outline-light btn-sm" onClick={history.back}><ChevronLeft size={20} /></button>
|
||||
<button type="button" class="btn btn-outline-light btn-sm" onClick={history.forward}><ChevronRight size={20} /></button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<nav
|
||||
class="navbar shadow fixed-top"
|
||||
style="background-color: var(--bs-content-bg); border-bottom: var(--bs-border-width) solid var(--bs-content-border-color);"
|
||||
>
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-brand">{wttrDesc}</div>
|
||||
<div class="d-flex hstack gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-light btn-sm"
|
||||
onClick={history.back}
|
||||
>
|
||||
<ChevronLeft size={20} />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-light btn-sm"
|
||||
onClick={history.forward}
|
||||
>
|
||||
<ChevronRight size={20} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue