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

77 lines
1.6 KiB
Vue
Raw Normal View History

2018-11-25 19:48:16 +01:00
<template>
2019-07-05 09:17:44 +02:00
<div
class="font-control style-control"
:class="{ custom: isCustom }"
>
<label
2023-03-04 05:38:56 +01:00
:id="name + '-label'"
2019-07-05 09:17:44 +02:00
:for="preset === 'custom' ? name : name + '-font-switcher'"
class="label"
>
{{ label }}
</label>
<input
v-if="typeof fallback !== 'undefined'"
:id="name + '-o'"
2023-03-04 05:38:56 +01:00
:aria-labelledby="name + '-label'"
class="opt exlcude-disabled visible-for-screenreader-only"
2019-07-05 09:17:44 +02:00
type="checkbox"
2022-03-27 13:16:23 +02:00
:checked="present"
@change="$emit('update:modelValue', typeof modelValue === 'undefined' ? fallback : undefined)"
2019-07-05 09:17:44 +02:00
>
<label
v-if="typeof fallback !== 'undefined'"
class="opt-l"
:for="name + '-o'"
2023-03-04 05:38:56 +01:00
:aria-hidden="true"
2019-07-05 09:17:44 +02:00
/>
2022-03-23 15:15:05 +01:00
{{ ' ' }}
<Select
:id="name + '-font-switcher'"
v-model="preset"
2018-11-25 19:48:16 +01:00
:disabled="!present"
class="font-switcher"
2019-07-05 09:17:44 +02:00
>
<option
v-for="option in availableOptions"
:key="option"
:value="option"
2019-07-05 09:17:44 +02:00
>
{{ option === 'custom' ? $t('settings.style.fonts.custom') : option }}
</option>
</Select>
2019-07-05 09:17:44 +02:00
<input
v-if="isCustom"
:id="name"
v-model="family"
class="custom-font"
type="text"
>
</div>
2018-11-25 19:48:16 +01:00
</template>
2022-07-31 11:35:48 +02:00
<script src="./font_control.js"></script>
2018-11-25 19:48:16 +01:00
<style lang="scss">
2023-01-09 19:02:16 +01:00
@import "../../variables";
2018-11-25 19:48:16 +01:00
.font-control {
input.custom-font {
min-width: 10em;
}
2023-01-09 19:02:16 +01:00
2018-11-25 22:19:28 +01:00
&.custom {
2021-03-11 15:31:15 +01:00
/* TODO Should make proper joiners... */
.font-switcher {
2018-11-25 22:19:28 +01:00
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
2023-01-09 19:02:16 +01:00
2018-11-25 22:19:28 +01:00
.custom-font {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
2018-11-25 19:48:16 +01:00
}
</style>