2018-10-09 14:07:28 -07:00
|
|
|
<template>
|
2018-11-14 08:39:17 -08:00
|
|
|
<span v-if="contrast" class="contrast-ratio">
|
2018-11-21 09:18:49 -08:00
|
|
|
<span :title="hint" class="rating">
|
2018-11-13 05:30:01 -08:00
|
|
|
<span v-if="contrast.aaa">
|
|
|
|
<i class="icon-thumbs-up-alt"/>
|
|
|
|
</span>
|
|
|
|
<span v-if="!contrast.aaa && contrast.aa">
|
|
|
|
<i class="icon-adjust"/>
|
2018-10-09 14:07:28 -07:00
|
|
|
</span>
|
2018-11-13 05:30:01 -08:00
|
|
|
<span v-if="!contrast.aaa && !contrast.aa">
|
|
|
|
<i class="icon-attention"/>
|
2018-10-09 14:07:28 -07:00
|
|
|
</span>
|
|
|
|
</span>
|
2018-11-21 09:18:49 -08:00
|
|
|
<span class="rating" v-if="contrast && large" :title="hint_18pt">
|
|
|
|
<span v-if="contrast.laaa">
|
2018-11-13 05:30:01 -08:00
|
|
|
<i class="icon-thumbs-up-alt"/>
|
|
|
|
</span>
|
2018-11-21 09:18:49 -08:00
|
|
|
<span v-if="!contrast.laaa && contrast.laa">
|
2018-11-13 05:30:01 -08:00
|
|
|
<i class="icon-adjust"/>
|
2018-10-09 14:07:28 -07:00
|
|
|
</span>
|
2018-11-21 09:18:49 -08:00
|
|
|
<span v-if="!contrast.laaa && !contrast.laa">
|
2018-11-13 05:30:01 -08:00
|
|
|
<i class="icon-attention"/>
|
2018-10-09 14:07:28 -07:00
|
|
|
</span>
|
|
|
|
</span>
|
2018-11-13 05:30:01 -08:00
|
|
|
</span>
|
2018-10-09 14:07:28 -07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: [
|
|
|
|
'large', 'contrast'
|
2018-11-21 09:18:49 -08:00
|
|
|
],
|
|
|
|
computed: {
|
|
|
|
hint () {
|
|
|
|
const levelVal = this.contrast.aaa ? 'aaa' : (this.contrast.aa ? 'aa' : 'bad')
|
|
|
|
const level = this.$t(`settings.style.common.contrast.level.${levelVal}`)
|
|
|
|
const context = this.$t('settings.style.common.contrast.context.text')
|
|
|
|
const ratio = this.contrast.text
|
|
|
|
return this.$t('settings.style.common.contrast.hint', { level, context, ratio })
|
|
|
|
},
|
|
|
|
hint_18pt () {
|
|
|
|
const levelVal = this.contrast.laaa ? 'aaa' : (this.contrast.laa ? 'aa' : 'bad')
|
|
|
|
const level = this.$t(`settings.style.common.contrast.level.${levelVal}`)
|
|
|
|
const context = this.$t('settings.style.common.contrast.context.18pt')
|
|
|
|
const ratio = this.contrast.text
|
|
|
|
return this.$t('settings.style.common.contrast.hint', { level, context, ratio })
|
|
|
|
}
|
|
|
|
}
|
2018-10-09 14:07:28 -07:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.contrast-ratio {
|
|
|
|
display: flex;
|
2018-11-14 11:20:42 -08:00
|
|
|
justify-content: flex-end;
|
2018-10-09 14:07:28 -07:00
|
|
|
|
|
|
|
.label {
|
|
|
|
margin-right: 1em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.rating {
|
|
|
|
display: inline-block;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|