Slider and text input changes (#65)

This commit is contained in:
Adrian O.V 2023-06-10 12:18:15 -04:00 committed by GitHub
parent 01304e807a
commit cea5a18a7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 10 deletions

View File

@ -8,8 +8,8 @@ const valueTwo = ref(0)
</script> </script>
<DemoContainer> <DemoContainer>
<Slider v-model="value" :min="1000" :max="10000" :step="1000"/> <Slider v-model="value" :min="1000" :max="10000" :step="1000" unit="mb"/>
<Slider v-model="valueTwo" :min="1000" :max="10000" :step="1000" :disabled="true"/> <Slider v-model="valueTwo" :min="1000" :max="10000" :step="1000" unit="mb" :disabled="true"/>
</DemoContainer> </DemoContainer>
```vue ```vue

View File

@ -1,4 +1,9 @@
# Text Inputs # Text Inputs
<script setup>
import { ref } from "vue";
const inputText = ref(null)
</script>
<DemoContainer> <DemoContainer>
<input <input
type="text" type="text"
@ -17,18 +22,31 @@
<div class="iconified-input"> <div class="iconified-input">
<SearchIcon/> <SearchIcon/>
<input <input
v-model="inputText"
type="text" type="text"
placeholder="Text input" placeholder="Text input"
/> />
<Button @click="() => inputText = ''">
<XIcon/>
</Button>
</div> </div>
</DemoContainer> </DemoContainer>
```vue ```vue
<script setup>
import { ref } from "vue";
const inputText = ref(null)
</script>
<div class="iconified-input"> <div class="iconified-input">
<SearchIcon/> <SearchIcon/>
<input <input
v-model="inputText"
type="text" type="text"
placeholder="Text input" placeholder="Text input"
/> />
<Button @click="() => inputText = ''">
<XIcon/>
</Button>
</div> </div>
``` ```

View File

@ -99,7 +99,7 @@ input[type='number'] {
position: relative; position: relative;
input { input {
padding-left: 2.25rem; padding: 0 2.5rem;
width: 100%; width: 100%;
} }
@ -118,6 +118,19 @@ input[type='number'] {
color: var(--color-base); color: var(--color-base);
opacity: 0.6; opacity: 0.6;
} }
.btn {
@extend .transparent, .icon-only;
position: absolute;
right: 0.25rem;
z-index: 1;
svg {
position: relative;
left: 0;
}
}
} }
svg { svg {

View File

@ -22,12 +22,8 @@
@input="onInput($refs.input.value)" @input="onInput($refs.input.value)"
/> />
<div class="slider-range"> <div class="slider-range">
<span> <span> {{ min }} {{ unit }} </span>
{{ min }} <span> {{ max }} {{ unit }} </span>
</span>
<span>
{{ max }}
</span>
</div> </div>
</div> </div>
</div> </div>
@ -72,6 +68,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
unit: {
type: String,
default: '',
},
}) })
let currentValue = ref(Math.max(props.min, props.modelValue).toString()) let currentValue = ref(Math.max(props.min, props.modelValue).toString())
@ -178,6 +178,7 @@ const onInput = (value) => {
} }
.disabled { .disabled {
filter: brightness(0.8); opacity: 0.5;
cursor: not-allowed;
} }
</style> </style>