fix: some small style things
This commit is contained in:
parent
c7bcc0415a
commit
2d56710223
@ -6,7 +6,7 @@ export function Button(props: JSX.HTMLAttributes<HTMLButtonElement>) {
|
|||||||
<button
|
<button
|
||||||
{...props}
|
{...props}
|
||||||
disabled={!IS_BROWSER || props.disabled}
|
disabled={!IS_BROWSER || props.disabled}
|
||||||
class="px-2 py-1 border-gray-500 border-2 "
|
class={`px-2 py-1 ${props.class ? props.class : " "}`}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -8,3 +8,5 @@ export { default as IconError404 } from "https://deno.land/x/tabler_icons_tsx@0.
|
|||||||
export { default as IconSquareRoundedPlus } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/square-rounded-plus.tsx";
|
export { default as IconSquareRoundedPlus } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/square-rounded-plus.tsx";
|
||||||
export { default as IconReportSearch } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/report-search.tsx";
|
export { default as IconReportSearch } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/report-search.tsx";
|
||||||
export { default as IconRefresh } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/refresh.tsx";
|
export { default as IconRefresh } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/refresh.tsx";
|
||||||
|
export { default as IconCirclePlus } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/circle-plus.tsx";
|
||||||
|
export { default as IconCircleMinus } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/circle-minus.tsx";
|
||||||
|
@ -1,16 +1,32 @@
|
|||||||
import type { Signal } from "@preact/signals";
|
import type { Signal } from "@preact/signals";
|
||||||
import { Button } from "@components/Button.tsx";
|
import { Button } from "@components/Button.tsx";
|
||||||
|
import { IconCircleMinus, IconCirclePlus } from "@components/icons.tsx";
|
||||||
|
|
||||||
interface CounterProps {
|
interface CounterProps {
|
||||||
count: Signal<number>;
|
count: Signal<number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Counter(props: CounterProps) {
|
export default function Counter(props: CounterProps) {
|
||||||
|
props.count.value = Math.max(1, props.count.value);
|
||||||
return (
|
return (
|
||||||
<div class="flex gap-2 items-center">
|
<div class="flex items-center px-1 py-2 rounded-xl">
|
||||||
<Button onClick={() => props.count.value -= 1}>-</Button>
|
<Button
|
||||||
<p class="text-3xl">{props.count}</p>
|
class=""
|
||||||
<Button onClick={() => props.count.value += 1}>+</Button>
|
onClick={() => props.count.value -= 1}
|
||||||
|
>
|
||||||
|
<IconCircleMinus />
|
||||||
|
</Button>
|
||||||
|
<input
|
||||||
|
class="text-3xl bg-transparent inline text-center -mx-4"
|
||||||
|
size={props.count.toString().length}
|
||||||
|
value={props.count}
|
||||||
|
onInput={(ev) => props.count.value = ev.target?.value}
|
||||||
|
>
|
||||||
|
{props.count}
|
||||||
|
</input>
|
||||||
|
<Button onClick={() => props.count.value += 1}>
|
||||||
|
<IconCirclePlus />
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ export const KMenu = (
|
|||||||
const input = useRef<HTMLInputElement>(null);
|
const input = useRef<HTMLInputElement>(null);
|
||||||
const commandInput = useSignal("");
|
const commandInput = useSignal("");
|
||||||
|
|
||||||
const visible = useSignal(true);
|
const visible = useSignal(false);
|
||||||
if (visible.value === false) {
|
if (visible.value === false) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
activeMenuType.value = "main";
|
activeMenuType.value = "main";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user