You've already forked AstralRinth
forked from didirus/AstralRinth
Add basic slider component
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"printWidth": 100
|
||||
"printWidth": 100,
|
||||
"tabWidth": 4
|
||||
}
|
||||
|
||||
50
src/package/components/Slider.svelte
Normal file
50
src/package/components/Slider.svelte
Normal file
@@ -0,0 +1,50 @@
|
||||
<script lang="ts">
|
||||
import type { SvelteComponent } from 'svelte';
|
||||
|
||||
export let value: number;
|
||||
export let min: number;
|
||||
export let max: number;
|
||||
export let id: string = undefined;
|
||||
</script>
|
||||
|
||||
<div class="slider">
|
||||
<input class="slider-input" type="range" name={id} {min} {max} bind:value />
|
||||
<span>{value}</span>
|
||||
</div>
|
||||
|
||||
<style lang="postcss">
|
||||
.slider {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.slider-input {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
border-radius: var(--rounded-sm);
|
||||
box-shadow: var(--shadow-inset-sm);
|
||||
background-color: var(--color-button-bg);
|
||||
border: none;
|
||||
padding: 0.25rem 0;
|
||||
width: 20rem;
|
||||
height: 0.5rem;
|
||||
max-width: 100%;
|
||||
cursor: pointer;
|
||||
|
||||
&::-webkit-slider-thumb {
|
||||
cursor: ew-resize;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 0.5rem;
|
||||
height: 1.25rem;
|
||||
border-radius: var(--rounded-sm);
|
||||
background-color: var(--color-brand);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--color-brand-dark);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -18,9 +18,10 @@ export { default as Pagination } from './components/Pagination.svelte';
|
||||
|
||||
export { default as Select } from './components/Select.svelte';
|
||||
|
||||
export { default as Slider } from './components/Slider.svelte';
|
||||
|
||||
export { default as TextInput } from './components/TextInput.svelte';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
```svelte example raised
|
||||
<script lang="ts">
|
||||
import { FormField } from "omorphia";
|
||||
import { Slider } from "omorphia";
|
||||
import { TextInput } from "omorphia";
|
||||
</script>
|
||||
|
||||
<FormField label="Favorite number">
|
||||
<Slider min=0 max=100 value=69 />
|
||||
</FormField>
|
||||
<FormField label="Favorite color">
|
||||
<TextInput placeholder="Enter another color..." />
|
||||
</FormField>
|
||||
|
||||
7
src/routes/components/Slider.md
Normal file
7
src/routes/components/Slider.md
Normal file
@@ -0,0 +1,7 @@
|
||||
```svelte example
|
||||
<script lang="ts">
|
||||
import { Slider } from "omorphia";
|
||||
</script>
|
||||
|
||||
<Slider min=0 max=10 value=4 />
|
||||
```
|
||||
Reference in New Issue
Block a user