Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte Slider snippet with arguments #3202

Closed
endigo9740 opened this issue Feb 9, 2025 · 1 comment
Closed

Svelte Slider snippet with arguments #3202

endigo9740 opened this issue Feb 9, 2025 · 1 comment

Comments

@endigo9740
Copy link
Contributor

Discussed in #3201

Originally posted by Akkretion February 9, 2025
Hey guys, it seems to me that in the Svelte Slider implementation the Slider always goes from 0 to 100. I can specify markers (from 0 to 100) which appear as numbers at their respective positions. I can also pass a snippet that is rendered at these positions instead, but it is constant.
I would like to pass a snippet which takes an argument (i.e. the marker value) so I can render different Icons or numbers in case I want the slider to represent something else than the numbers 0 to 100.
Currently there is no way to do that, right?
But the change in the implementation of the component would literally just be changing

...
{#each markers as value}
<!-- Mark -->
<span {...api.getMarkerProps({ value })} class="{markBase} {markText} {markOpacity} {markClasses}" data-testid="slider-mark">
	{#if mark}
		{@render mark()}
	{:else}
		{value}
	{/if}
</span>
{/each}
...

to

...
{#each markers as value}
<!-- Mark -->
<span {...api.getMarkerProps({ value })} class="{markBase} {markText} {markOpacity} {markClasses}" data-testid="slider-mark">
	{#if mark}
		{@render mark(value)}
	{:else}
		{value}
	{/if}
</span>
{/each}
...

Should I open a Pull request?

@Akkretion
Copy link

Create a small PR in #3205
As I said there:
Not sure if there is anything else that I should do in order for this to be mergeable.
Pipelines are red. Also, I am not sure if there are any relevant docs I should update.
Sorry, this is my first time "contributing" to this project.
Let me know!

endigo9740 added a commit that referenced this issue Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants