feat: styles and mark tasks
This commit is contained in:
@@ -1,16 +1,40 @@
|
||||
import { FunctionComponent } from "preact";
|
||||
import { tv } from "tailwind-variants";
|
||||
import classes from "./task.module.scss";
|
||||
|
||||
interface TaskProps {
|
||||
name: string;
|
||||
checked?: boolean;
|
||||
}
|
||||
|
||||
const Task: FunctionComponent<TaskProps> = ({ name }: TaskProps) => {
|
||||
const taskStyle = tv({
|
||||
base: "flex aspect-square h-full flex-col items-center justify-center rounded-full border",
|
||||
variants: {
|
||||
checked: {
|
||||
true: "bg-black",
|
||||
false: "bg-white",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const markStyle = tv({
|
||||
base: "text-4xl font-light text-white",
|
||||
variants: {
|
||||
checked: {
|
||||
true: "block",
|
||||
false: "hidden",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const Task: FunctionComponent<TaskProps> = ({ name, checked = false }: TaskProps) => {
|
||||
return (
|
||||
// Временное действие для тестирования
|
||||
<button onClick={() => alert(name)}>
|
||||
<div class={classes.task}>
|
||||
<div class="aspect-square h-full rounded-full border bg-white"></div>
|
||||
<div class={taskStyle({ checked })}>
|
||||
<p class={markStyle({ checked })}>✓</p>
|
||||
</div>
|
||||
{name}
|
||||
</div>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user