aboutsummaryrefslogtreecommitdiff
path: root/src/components/settings_modal/helpers/unit_setting.vue
blob: d6aafe2680edfb385a66548d1dec256a310356d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<template>
  <span
    v-if="matchesExpertLevel"
    class="UnitSetting"
  >
    <label
      :for="path"
      class="size-label"
    >
      <slot />
    </label>
    <input
      :id="path"
      class="number-input"
      type="number"
      step="1"
      :disabled="disabled"
      :min="min || 0"
      :value="stateValue"
      @change="updateValue"
    >
    <Select
      :id="path"
      :model-value="stateUnit"
      :disabled="disabled"
      class="unit-input unstyled"
      @change="updateUnit"
    >
      <option
        v-for="option in units"
        :key="option"
        :value="option"
      >
        {{ getUnitString(option) }}
      </option>
    </Select>
    {{ ' ' }}
    <ModifiedIndicator
      :changed="isChanged"
      :onclick="reset"
    />
  </span>
</template>

<script src="./unit_setting.js"></script>

<style lang="scss">
.UnitSetting {
  .number-input {
    max-width: 6.5em;
    text-align: right;
  }

  .unit-input,
  .unit-input select {
    min-width: 4em;
    width: auto;
  }
}

</style>