Skip to content

Commit

Permalink
fix(slider): add style
Browse files Browse the repository at this point in the history
  • Loading branch information
koory1st committed Dec 11, 2023
1 parent fffe114 commit bc989d9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
4 changes: 3 additions & 1 deletion packages/slider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
"registry": "https://registry.npmjs.org"
},
"devDependencies": {
"@svelement-ui/input-number": "workspace:^",
"@svelement-ui/theme-chalk": "workspace:^",
"@svelement-ui/util-array-2-class-string": "workspace:^",
"@svelement-ui/util-array-2-style-string": "workspace:^"
"@svelement-ui/util-array-2-style-string": "workspace:^",
"to-style": "^1.3.3"
},
"repository": {
"type": "git",
Expand Down
17 changes: 17 additions & 0 deletions packages/slider/src/lib/button.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script>
import a2s from '@svelement-ui/util-array-2-class-string';
$: hovering = false;
$: dragging = false;
$: wrapperClass = a2s([
`svel-slider__button-wrapper`,
['hover', hovering],
['dragging', dragging],
]);
$: wrapperStyle = null;
$: buttonClass = a2s([`svel-slider__button`, ['hover', hovering], ['dragging', dragging]]);
</script>

<div class={wrapperClass} style={wrapperStyle}>
<div class={buttonClass} />
</div>
13 changes: 9 additions & 4 deletions packages/slider/src/lib/slider.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<script>
import SvelInputNumber from '@svelement-ui/input-number';
import Button from '$lib/button.svelte';
let slider;
let firstValue;
</script>

<div class="svel-slider">
<div class="svel-slider__runway">
<div bind:this={slider} class="svel-slider__runway">
<div class="svel-slider__bar" />
<div class="svel-slider__button-wrapper">
<div class="svel-slider__button" />
</div>
<Button />
</div>
<SvelInputNumber bind:value={firstValue} />
</div>
5 changes: 0 additions & 5 deletions packages/slider/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<script>
import SvelSlider from '$lib/index.js';
let list = [];
for (let i = 0; i < 10; i++) {
list.push(i);
}
</script>

<SvelSlider />
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bc989d9

Please sign in to comment.