Skip to content

Commit

Permalink
Merge remote-tracking branch 'nkymut/sliderconfig'
Browse files Browse the repository at this point in the history
  • Loading branch information
nkymut committed Nov 29, 2024
2 parents 830bbdd + 3c70eaa commit 3e84ea1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/codemirror/slider.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class SliderWidget extends WidgetType {
width: '128px',
height: '16px',
color: '#3b82f6', // default blue color
background: '#ddd',
};

// Parse CSS string using temporary DOM element
Expand All @@ -36,7 +37,7 @@ export class SliderWidget extends WidgetType {
if (color) userConfig.color = color;
if (background) userConfig.background = background;
}
//console.log(userConfig)
//console.log(userConfig);
// Only override defaults if config is provided and values are defined
this.config = {
...defaultConfig,
Expand Down Expand Up @@ -70,18 +71,18 @@ export class SliderWidget extends WidgetType {
slider.originalFrom = this.originalFrom;
slider.to = this.to;

//slider.style = 'width:64px;margin-right:4px;transform:translateY(4px);'+this.config;
// slider.style = 'width:64px;margin-right:4px;transform:translateY(4px);'+this.config;
// Apply custom styling
const styles = [
`background: ${this.config.background}`,
'-webkit-appearance: none',
`background: linear-gradient(to right,${this.config.background} 0%, ${this.config.background} 100%) scroll `,
'border-radius: 4px',
`width: ${this.config.width}`,
`height: ${this.config.height}`,
'margin-right: 4px',
'margin-bottom: 4px',
//'transform: translateY(calc(50%))', // Center vertically relative to text
'vertical-align: middle', // Align with text baseline
// Custom slider styling
`accent-color:${this.config.background}`,
'margin-bottom: 2px',
'vertical-align: text-bottom',
`accent-color: ${this.config.color}`,
];

slider.style = styles.join(';');
Expand Down

0 comments on commit 3e84ea1

Please sign in to comment.