live_svelte/example_project/assets/svelte/LightStatusBar.svelte
Denis Donici bfdae993c2
feat/add comprehensive e2e testing (#207)
* add an exmaple with a static svelte component in a live view parent with list

* adjusted the styling of example

* chore: added more e2e tests

* chore: preserve client state

* chore: added tests for simple counter

* chore: added live lights e2e tests

* chore: added sigil e2e tests

* chore: added plus/minus tests

* chore: added live plus/minus tests

* chore: added hybrid plus/minus tests

* chore: added static color demo tests

* fix: handle correctly v sigil props

* chore: added tests to log list example

* chore: added tests to breaking news example

* chore: added chat tests

* chore: added tests for live json

* chore: added tests for simple slots

* chore: added tests for dynamic slots. added missing test ids

* chore: add tests to client loading

* chore: addes tests to otp ecto example

* chore: prepare for 0.17.4 release
2026-02-18 21:30:17 +02:00

43 lines
1.4 KiB
Svelte

<script>
import {run} from "svelte/legacy"
import {tweened} from "svelte/motion"
import {cubicOut} from "svelte/easing"
/** @type {{ brightness?: number }} */
let {brightness = 0} = $props()
const progress = tweened(0, {
duration: 400,
easing: cubicOut,
})
const updateProgress = b => progress.set(b / 100)
run(() => {
updateProgress(brightness)
})
</script>
<div class="card bg-base-100 shadow-md border border-base-300/50 overflow-hidden md:min-w-md">
<div class="card-body gap-3 p-4">
<span class="badge badge-ghost badge-sm font-medium text-base-content/70 w-fit"> Brightness </span>
<progress class="progress progress-brand border-0 w-full rounded-full h-3 bg-base-200" value={$progress} max="1"></progress>
<div class="flex items-center justify-center min-h-10">
<span class="font-mono text-lg font-semibold tabular-nums {brightness > 0 ? 'text-brand' : 'text-base-content/50'}" data-testid="light-brightness-value">
{brightness > 0 ? `${brightness}%` : "OFF"}
</span>
</div>
</div>
</div>
<style>
.progress-brand {
color: var(--color-brand);
}
.progress-brand::-webkit-progress-value {
background-color: var(--color-brand);
}
.progress-brand::-moz-progress-bar {
background-color: var(--color-brand);
}
</style>