feat: rewrite to solidjs
This commit is contained in:
parent
74c6215c27
commit
afa2db26e7
21 changed files with 1074 additions and 1835 deletions
46
entrypoints/popup/App.tsx
Normal file
46
entrypoints/popup/App.tsx
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { createSignal } from "solid-js";
|
||||
import "./style.css";
|
||||
|
||||
import { MainToggle } from "@/components/MainToggle";
|
||||
import { BlockedSite } from "@/components/BlockedSite";
|
||||
import { Todo } from "@/components/Todo";
|
||||
|
||||
function App() {
|
||||
const menus = ["main", "completed", "blocked sites"];
|
||||
|
||||
const [menu, setMenu] = createSignal("main");
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<MainToggle />
|
||||
<h1>let me focus</h1>
|
||||
<ul class="menu">
|
||||
<For each={menus}>
|
||||
{(menu) => (
|
||||
<li>
|
||||
<button onClick={() => setMenu(menu)}>[{menu}]</button>
|
||||
</li>
|
||||
)}
|
||||
</For>
|
||||
</ul>
|
||||
<Suspense>
|
||||
<Switch>
|
||||
<Match when={menu() === "main"}>
|
||||
<Todo showInput hoverShowDeleteButton />
|
||||
</Match>
|
||||
<Match when={menu() === "completed"}>
|
||||
<Todo showOnlyCompleted showClearAllTodo />
|
||||
</Match>
|
||||
<Match when={menu() === "blocked sites"}>
|
||||
<BlockedSite />
|
||||
</Match>
|
||||
</Switch>
|
||||
</Suspense>
|
||||
<br />[{browser.runtime.getManifest().version}]
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
<script lang="ts" setup>
|
||||
import ToggleOnOff from "@/components/ToggleOnOff.vue";
|
||||
import Todo from "@/components/Todo.vue"
|
||||
import BlockedSite from "@/components/BlockedSite.vue"
|
||||
const currentMenu = ref("main")
|
||||
const menuLists = [
|
||||
"main",
|
||||
"completed",
|
||||
"blocked sites",
|
||||
]
|
||||
|
||||
const changeMenu = (menu: string) => {
|
||||
currentMenu.value = menu
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ToggleOnOff />
|
||||
<h1>let me focus</h1>
|
||||
<ul style="text-align: center;" v-for="menu in menuLists">
|
||||
<li>
|
||||
<button @click="changeMenu(menu)">[{{ menu }}]</button>
|
||||
</li>
|
||||
</ul>
|
||||
<Todo v-if="currentMenu === 'main'" showInput hoverShowDeleteButton />
|
||||
<Todo v-if="currentMenu === 'completed'" showOnlyCompleted showClearAllTodo />
|
||||
<BlockedSite v-if="currentMenu === 'blocked sites'" />
|
||||
<br/>
|
||||
[{{browser.runtime.getManifest().version}}]
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
ul {
|
||||
padding: 0;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
li {
|
||||
list-style: none;
|
||||
margin: 0px 5px;
|
||||
}
|
||||
|
||||
li button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
filter: drop-shadow(0 0 1em #ffffff);
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>let me focus</title>
|
||||
<meta name="manifest.type" content="browser_action" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="./main.ts"></script>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>let me focus</title>
|
||||
<meta name="manifest.type" content="browser_action" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="./main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
import { createApp } from 'vue';
|
||||
import './style.css';
|
||||
import App from './App.vue';
|
||||
|
||||
createApp(App).mount('#app');
|
||||
6
entrypoints/popup/main.tsx
Normal file
6
entrypoints/popup/main.tsx
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { render } from "solid-js/web";
|
||||
|
||||
import "./style.css";
|
||||
import App from "./App";
|
||||
|
||||
render(() => <App />, document.getElementById("root")!);
|
||||
|
|
@ -1,42 +1,54 @@
|
|||
:root {
|
||||
font-family: monospace;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
color-scheme: light dark;
|
||||
color: #ffffff;
|
||||
background-color: #222222;
|
||||
font-family: monospace;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
color-scheme: light dark;
|
||||
color: #ffffff;
|
||||
background-color: #222222;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 400px;
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 400px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2.4em;
|
||||
font-size: 2.4em;
|
||||
}
|
||||
|
||||
button {
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
#app {
|
||||
max-width: 400px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
#root {
|
||||
max-width: 400px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #222222;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
:root {
|
||||
color: #222222;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
}
|
||||
|
||||
ul.menu {
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
ul.menu li {
|
||||
list-style: none;
|
||||
margin: 0px 5px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
ul.menu li button {
|
||||
cursor: pointer;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue