Skip to content

Commit 1ec5add

Browse files
committed
fix: remove hasCSSVariableValue, always assume that marks has string value
1 parent f912ffe commit 1ec5add

File tree

1 file changed

+5
-5
lines changed
  • src/components/advanced-range-control

1 file changed

+5
-5
lines changed

src/components/advanced-range-control/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,12 @@ const AdvancedRangeControl = props => {
114114
}
115115
const [ isMarkMode, setIsMarkMode ] = useState( isMarkValue )
116116

117-
// If this supports dynamic content and can have CSS variables, the value should be saved as a String.
117+
// If this supports dynamic content, the value should be saved as a String.
118+
// Similar if using marks to accomodate CSS variable
118119
// Important, the attribute type for this option should be a string.
119120
const _onChange = value => {
120121
const onChangeFunc = typeof props.onChange === 'undefined' ? onChange : props.onChange
121-
let newValue = props.isDynamic || props.hasCSSVariableValue ? value.toString() : value
122+
let newValue = props.isDynamic || props.marks ? value.toString() : value
122123

123124
// On reset, allow overriding the value.
124125
if ( newValue === '' ) {
@@ -183,7 +184,7 @@ const AdvancedRangeControl = props => {
183184

184185
// We need to change the way we handle the value and onChange if we're doing marks
185186
// Convert to float if the attribute is string to work with the slider
186-
let rangeValue = propsToPass.isDynamic || props.hasCSSVariableValue ? parseFloat( derivedValue ) : derivedValue
187+
let rangeValue = propsToPass.isDynamic || props.marks ? parseFloat( derivedValue ) : derivedValue
187188
let rangeOnChange = _onChange
188189
if ( isMarkMode ) {
189190
rangeValue = props.marks.findIndex( mark => {
@@ -277,9 +278,8 @@ AdvancedRangeControl.defaultProps = {
277278
onOverrideReset: undefined,
278279
forcePlaceholder: false,
279280

280-
marks: undefined, // [{ value: '14px', name: 'S' }, { value: '16px', name: 'M' }]
281+
marks: undefined, // [{ value: 'var(--stk-preset-font-size-small', name: 'S' }]
281282
allowCustom: true,
282-
hasCSSVariableValue: false, // If the attribute can have CSS variable value (string attribute)
283283
isCustomPreset: false,
284284
}
285285

0 commit comments

Comments
 (0)