api-client/components/settings/swatch.vue

71 lines
1.4 KiB
Vue
Raw Normal View History

<template>
2019-09-17 09:55:32 +00:00
<div class="color" :data-color="color">
<span :style="{backgroundColor: color}" class="preview">
<svg v-if="active" class="activeTick" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="12"/>
2019-09-17 09:55:32 +00:00
</svg>
</span>
{{ name || color }}
</div>
</template>
<style lang="scss">
2019-09-17 09:55:32 +00:00
.color {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 16px 0 4px;
2019-09-17 09:55:32 +00:00
margin: 4px;
background-color: var(--bg-dark-color);
2019-09-17 09:55:32 +00:00
color: var(--fg-color);
border-radius: 20px;
2019-09-17 09:55:32 +00:00
cursor: pointer;
height: 40px;
2019-09-17 09:55:32 +00:00
&.active {
background-color: var(--bg-dark-color);
}
2019-09-17 09:55:32 +00:00
.preview {
vertical-align: middle;
display: inline-block;
border-radius: 100%;
margin-right: 8px;
padding: 16px;
position: relative;
2019-09-17 09:55:32 +00:00
.activeTick {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
fill: #fff;
}
}
2019-09-17 09:55:32 +00:00
}
2019-09-17 09:55:32 +00:00
.color.vibrant {
.preview .activeTick {
fill: var(--act-color);
}
2019-09-17 09:55:32 +00:00
}
</style>
<script>
2019-09-17 09:55:32 +00:00
export default {
props: {
'color': {
type: String,
required: true
},
'name': {
type: String
},
'active': {
type: Boolean,
default: false
}
}
2019-09-17 09:55:32 +00:00
}
2019-09-17 08:13:12 +00:00
</script>