aboutsummaryrefslogtreecommitdiff
path: root/src/components/font_control/font_control.vue
blob: 2006c7f6ea8478f78d82c63261338335fdc0bc44 (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
62
63
64
65
66
67
68
69
70
<template>
  <div
    class="font-control style-control"
    :class="{ custom: isCustom }"
  >
    <label
      :for="preset === 'custom' ? name : name + '-font-switcher'"
      class="label"
    >
      {{ label }}
    </label>
    <input
      v-if="typeof fallback !== 'undefined'"
      :id="name + '-o'"
      class="opt exlcude-disabled"
      type="checkbox"
      :modelValue="present"
      @input="$emit('update:modelValue', typeof value === 'undefined' ? fallback : undefined)"
    >
    <label
      v-if="typeof fallback !== 'undefined'"
      class="opt-l"
      :for="name + '-o'"
    />
    {{ ' ' }}
    <Select
      :id="name + '-font-switcher'"
      v-model="preset"
      :disabled="!present"
      class="font-switcher"
    >
      <option
        v-for="option in availableOptions"
        :key="option"
        :value="option"
      >
        {{ option === 'custom' ? $t('settings.style.fonts.custom') : option }}
      </option>
    </Select>
    <input
      v-if="isCustom"
      :id="name"
      v-model="family"
      class="custom-font"
      type="text"
    >
  </div>
</template>

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

<style lang="scss">
@import '../../_variables.scss';
.font-control {
  input.custom-font {
    min-width: 10em;
  }
  &.custom {
    /* TODO Should make proper joiners... */
    .font-switcher {
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }
    .custom-font {
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
    }
  }
}
</style>