--- // With an id → a noUiSlider div + init script; without an id → a native . import CaptureScript from '../components/CaptureScript.astro'; interface Props { min?: number; max?: number; value?: string | number; id?: string; connect?: boolean; class?: string; } const { min = 0, max = 100, value = 50, id, connect = false, class: className } = Astro.props; const step = 10; const values = String(value).split(','); const size = values.length; const numericValues = values.map(Number); const startValue = size > 1 ? numericValues : numericValues[0]; // Connect array: alternate false/true for mid segments, then true, false. let connectValue; if (size > 1 || connect) { const parts: boolean[] = []; for (let i = 2; i <= size; i++) parts.push((i - 2) % 2 !== 0); connectValue = [...parts, true, false]; } const rangeId = `range-${id}`; --- { id ? (
) : ( ) } { id && ( ) }