23 lines
483 B
Svelte
23 lines
483 B
Svelte
<script lang="ts">
|
|
interface Props {
|
|
ativo: boolean;
|
|
bloqueado?: boolean;
|
|
}
|
|
|
|
let { ativo, bloqueado = false }: Props = $props();
|
|
|
|
const getStatus = () => {
|
|
if (bloqueado) return { text: "Bloqueado", class: "badge-error" };
|
|
if (ativo) return { text: "Ativo", class: "badge-success" };
|
|
return { text: "Inativo", class: "badge-warning" };
|
|
};
|
|
|
|
const status = $derived(getStatus());
|
|
</script>
|
|
|
|
<span class="badge {status.class}">
|
|
{status.text}
|
|
</span>
|
|
|
|
|