pleroma-fe/src/components/font_control/font_control.vue

83 lines
1.9 KiB
Vue
Raw Normal View History

2018-11-25 21:48:16 +03:00
<template>
2019-07-05 10:17:44 +03:00
<div
2024-06-26 14:17:22 +03:00
class="font-control"
2019-07-05 10:17:44 +03:00
:class="{ custom: isCustom }"
>
<label
2023-03-03 23:38:56 -05:00
:id="name + '-label'"
2019-07-05 10:17:44 +03:00
:for="preset === 'custom' ? name : name + '-font-switcher'"
class="label"
>
{{ label }}
</label>
2024-06-26 14:17:22 +03:00
{{ ' ' }}
<Checkbox
2019-07-05 10:17:44 +03:00
v-if="typeof fallback !== 'undefined'"
:id="name + '-o'"
2024-06-26 14:17:22 +03:00
:modelValue="present"
2022-03-27 14:16:23 +03:00
@change="$emit('update:modelValue', typeof modelValue === 'undefined' ? fallback : undefined)"
2019-07-05 10:17:44 +03:00
>
2024-06-26 14:17:22 +03:00
{{ $t('settings.style.themes3.define') }}
</Checkbox>
<p>
<Select
:id="name + '-font-switcher'"
v-model="preset"
:disabled="!present"
class="font-switcher"
2019-07-05 10:17:44 +03:00
>
2024-06-26 14:17:22 +03:00
<option
v-for="option in availableOptions"
:key="option"
:value="option"
>
{{ $t('settings.style.themes3.font.' + option) }}
</option>
</Select>
</p>
<p>
<input
v-if="isCustom"
:id="name"
v-model="familyCustom"
class="input custom-font"
type="text"
>
<span
v-if="invalidCustom"
class="InvalidIndicator"
>
<Popover
trigger="hover"
:trigger-attrs="{ 'aria-label': $t('settings.style.themes3.font.invalid_custom_reserved') }"
>
<template #trigger>
&nbsp;
<FAIcon icon="exclamation-triangle" />
</template>
<template #content>
<div class="invalid-tooltip">
{{ $t('settings.style.themes3.font.invalid_custom_reserved') }}
</div>
</template>
</Popover>
</span>
</p>
2019-07-05 10:17:44 +03:00
</div>
2018-11-25 21:48:16 +03:00
</template>
2022-07-31 12:35:48 +03:00
<script src="./font_control.js"></script>
2018-11-25 21:48:16 +03:00
<style lang="scss">
.font-control {
input.custom-font {
2024-06-26 14:17:22 +03:00
min-width: 12em;
2018-11-25 21:48:16 +03:00
}
2024-06-26 14:17:22 +03:00
}
2023-01-09 13:02:16 -05:00
2024-06-26 14:17:22 +03:00
.invalid-tooltip {
margin: 0.5em 1em;
min-width: 10em;
text-align: center;
2018-11-25 21:48:16 +03:00
}
</style>