This commit is contained in:
62
frontend/app/components/layouts/ColorPicker.vue
Normal file
62
frontend/app/components/layouts/ColorPicker.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
const color = ref("");
|
||||
const colorValue = ref(null);
|
||||
const colorPicker = ref(null);
|
||||
|
||||
const selectedColorCode = ref(null);
|
||||
|
||||
onMounted(() => {
|
||||
colorValue.value.addEventListener('click', () => {
|
||||
colorPicker.value.click();
|
||||
})
|
||||
|
||||
colorPicker.value.addEventListener('input', (event) => {
|
||||
let newColor = event.target.value;
|
||||
colorValue.value.classList.remove('unselected');
|
||||
colorValue.value.style.backgroundColor = newColor;
|
||||
color.value = newColor;
|
||||
selectedColorCode.value.textContent = color.value.toUpperCase();
|
||||
});
|
||||
});
|
||||
|
||||
let GetColor = () => color.value;
|
||||
|
||||
defineExpose({ GetColor });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<input type="color" id="colorPicker" ref="colorPicker">
|
||||
<div class="color-value unselected" ref="colorValue">
|
||||
<span class="selected-color-code" ref="selectedColorCode"></span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
#colorPicker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.color-value {
|
||||
width: 100px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
height: 20px;
|
||||
border-radius: 10px;
|
||||
|
||||
&.unselected {
|
||||
background-image: linear-gradient(45deg, #808080 25%, transparent 25%), linear-gradient(-45deg, #808080 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #808080 75%), linear-gradient(-45deg, transparent 75%, #808080 75%);
|
||||
background-size: 10px 10px;
|
||||
background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.selected-color-code {
|
||||
font-size: 12px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
84
frontend/app/components/layouts/IconButton.vue
Normal file
84
frontend/app/components/layouts/IconButton.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<script setup>
|
||||
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { AddTooltip } from '~/services/Tooltip';
|
||||
const props = defineProps(['icon', 'action', 'size', 'toggled', 'tooltip']);
|
||||
let icon = props.icon;
|
||||
let action = props.action;
|
||||
|
||||
let size = props.size;
|
||||
let toggled = props.toggled;
|
||||
let tooltip = props.tooltip;
|
||||
|
||||
const button = ref(null);
|
||||
|
||||
onMounted(() => {
|
||||
if(tooltip){
|
||||
AddTooltip(button.value, tooltip);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<template>
|
||||
<div class="icon-button sound-click" :class="size + ' ' + toggled" v-on:click.prevent="action" ref="button">
|
||||
<img class="icon" draggable="false" :src="icon" :class="size">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped lang="scss">
|
||||
.icon-button {
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
|
||||
&.big {
|
||||
height: 42px;
|
||||
width: 42px;
|
||||
}
|
||||
|
||||
&.small {
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
&.toggled {
|
||||
filter: invert(0.9);
|
||||
}
|
||||
|
||||
background-color: var(--color-background-soft);
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 2px;
|
||||
|
||||
transition: .3s background-color;
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.icon-button:hover {
|
||||
background-color: var(--color-background-softer);
|
||||
}
|
||||
|
||||
.icon {
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
pointer-events: none;
|
||||
|
||||
&.big {
|
||||
height: 38px;
|
||||
width: 38px;
|
||||
}
|
||||
|
||||
&.small {
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user