mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-06 05:38:44 +08:00
Format files
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { Head } from "$fresh/runtime.ts";
|
import { Head } from "$fresh/runtime.ts";
|
||||||
import { Component, ContextType } from "preact";
|
import { Component, ContextType } from "preact";
|
||||||
import { useState, StateUpdater, useEffect } from "preact/hooks";
|
import { StateUpdater, useEffect, useState } from "preact/hooks";
|
||||||
import Icon from "preact-material-components/Icon";
|
import Icon from "preact-material-components/Icon";
|
||||||
import List from "preact-material-components/List";
|
import List from "preact-material-components/List";
|
||||||
import TopAppBar from "preact-material-components/TopAppBar";
|
import TopAppBar from "preact-material-components/TopAppBar";
|
||||||
@@ -24,7 +24,7 @@ export default class Container extends Component<ContainerProps> {
|
|||||||
const v = typeof updater === "function" ? updater(state) : updater;
|
const v = typeof updater === "function" ? updater(state) : updater;
|
||||||
set_state1(v);
|
set_state1(v);
|
||||||
history.pushState(v, "", v);
|
history.pushState(v, "", v);
|
||||||
}
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const hash = document.location.hash;
|
const hash = document.location.hash;
|
||||||
if (!hash || hash == "#") {
|
if (!hash || hash == "#") {
|
||||||
@@ -32,15 +32,15 @@ export default class Container extends Component<ContainerProps> {
|
|||||||
} else {
|
} else {
|
||||||
set_state1(hash);
|
set_state1(hash);
|
||||||
}
|
}
|
||||||
self.addEventListener('popstate', (e) => {
|
self.addEventListener("popstate", (e) => {
|
||||||
const s = e.state;
|
const s = e.state;
|
||||||
if (typeof s === "string") {
|
if (typeof s === "string") {
|
||||||
set_state1(s);
|
set_state1(s);
|
||||||
} else {
|
} else {
|
||||||
set_state1("#/");
|
set_state1("#/");
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}, [])
|
}, []);
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Head>
|
<Head>
|
||||||
@@ -68,10 +68,12 @@ export default class Container extends Component<ContainerProps> {
|
|||||||
<List.Item onClick={() => set_display(false)}>
|
<List.Item onClick={() => set_display(false)}>
|
||||||
<Icon>close</Icon>
|
<Icon>close</Icon>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
<List.Item onClick={() => {
|
<List.Item
|
||||||
set_display(false);
|
onClick={() => {
|
||||||
set_state("#/");
|
set_display(false);
|
||||||
}}>
|
set_state("#/");
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Icon>home</Icon>
|
<Icon>home</Icon>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
<List.Item
|
<List.Item
|
||||||
|
|||||||
Reference in New Issue
Block a user