From 0fa55db0a5fdd2987139d8e01184836fba03d44e Mon Sep 17 00:00:00 2001 From: Mathis Chambon Date: Wed, 19 Jun 2024 14:07:35 +0200 Subject: [PATCH] feat(range): class fix --- assets/js/range.js | 4 +--- components/Atoms/Range/Range.twig | 2 +- components/Atoms/Range/range.css | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/assets/js/range.js b/assets/js/range.js index 2417a96..9ac0642 100644 --- a/assets/js/range.js +++ b/assets/js/range.js @@ -1,7 +1,5 @@ export const range = () => { - for (let e of document.querySelectorAll( - 'input[type="range"].slider-progress' - )) { + for (let e of document.querySelectorAll('.Range')) { e.style.setProperty('--value', e.value); e.style.setProperty('--min', e.min == '' ? '0' : e.min); e.style.setProperty('--max', e.max == '' ? '100' : e.max); diff --git a/components/Atoms/Range/Range.twig b/components/Atoms/Range/Range.twig index 18fbe5b..2a8b26a 100644 --- a/components/Atoms/Range/Range.twig +++ b/components/Atoms/Range/Range.twig @@ -1 +1 @@ - + diff --git a/components/Atoms/Range/range.css b/components/Atoms/Range/range.css index 1fb97f1..c6ddb8e 100644 --- a/components/Atoms/Range/range.css +++ b/components/Atoms/Range/range.css @@ -3,7 +3,7 @@ input[type='range'].Range { -webkit-appearance: none; } -input[type='range'].Range.slider-progress { +input[type='range'].Range { --range: calc(var(--max) - var(--min)); --ratio: calc((var(--value) - var(--min)) / var(--range)); --sx: calc(0.5 * 15px + var(--ratio) * (100% - 15px)); @@ -30,7 +30,7 @@ input[type='range'].Range::-webkit-slider-runnable-track { background: #d6d6d6; } -input[type='range'].Range.slider-progress::-webkit-slider-runnable-track { +input[type='range'].Range::-webkit-slider-runnable-track { background: linear-gradient(#fa533c, #fa533c) 0 / var(--sx) 100% no-repeat, #d6d6d6; @@ -52,7 +52,7 @@ input[type='range'].Range::-moz-range-track { box-shadow: none; } -input[type='range'].Range.slider-progress::-moz-range-track { +input[type='range'].Range::-moz-range-track { background: linear-gradient(#fa533c, #fa533c) 0 / var(--sx) 100% no-repeat, #d6d6d6; @@ -86,7 +86,7 @@ input[type='range'].Range::-ms-track { box-sizing: border-box; } -input[type='range'].Range.slider-progress::-ms-fill-lower { +input[type='range'].Range::-ms-fill-lower { height: 3px; border-radius: 5px 0 0 5px; margin: -undefined 0 -undefined -undefined;