-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
186 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<button class="flex flex-col items-center justify-center gap-1 p-2"> | ||
<slot /> | ||
</button> | ||
</template> | ||
|
||
<script setup lang="ts"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
<template> | ||
<button @click="$emit('clickDrag')"> | ||
<IconContainer @click="emit('clickDrag')"> | ||
<Icon | ||
:icon="`fluent:drag-20-regular`" | ||
:class="[props.isDraggable ? 'text-green-600' : 'opacity-20']" | ||
/> | ||
</button> | ||
</IconContainer> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import IconContainer from '@/components/icons/IconContainer.vue' | ||
import { Icon } from '@iconify/vue' | ||
const props = defineProps<{ | ||
isDraggable: boolean | ||
}>() | ||
const emit = defineEmits<{ | ||
(e: 'clickDrag'): void | ||
}>() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
<template> | ||
<button @click="$emit('clickEye')"> | ||
<IconContainer @click="emit('clickEye')"> | ||
<Icon :icon="props.isOpen ? 'iconamoon:eye-off' : 'iconamoon:eye'" /> | ||
</button> | ||
</IconContainer> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import IconContainer from '@/components/icons/IconContainer.vue' | ||
import { Icon } from '@iconify/vue' | ||
const props = defineProps<{ isOpen: boolean }>() | ||
</script> | ||
<style scoped></style> | ||
const emit = defineEmits<{ | ||
(e: 'clickEye'): void | ||
}>() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<IconContainer @click="handleClickImageUpload"> | ||
<Icon :icon="`uil:image-upload`" /> | ||
</IconContainer> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import IconContainer from '@/components/icons/IconContainer.vue' | ||
import { useFileSystemAccess } from '@vueuse/core' | ||
import { Icon } from '@iconify/vue' | ||
const emit = defineEmits<{ | ||
(e: 'uploadImage', base64: string): void | ||
}>() | ||
const { data, file, open } = useFileSystemAccess() | ||
const transformFileToBase64 = (file: File) => | ||
new Promise((resolve, reject) => { | ||
const fileReader = new FileReader() | ||
fileReader.onload = () => { | ||
resolve(fileReader.result) | ||
} | ||
fileReader.onerror = reject | ||
fileReader.readAsDataURL(file) | ||
}) | ||
const handleClickImageUpload = async () => { | ||
const pickerOpts = { | ||
types: [ | ||
{ | ||
description: 'Images', | ||
accept: { | ||
'image/*': ['.png', '.gif', '.jpeg', '.jpg'] | ||
} | ||
} | ||
], | ||
excludeAcceptAllOption: true, | ||
multiple: false | ||
} | ||
await open(pickerOpts) | ||
if (!file.value) return | ||
const base64 = await transformFileToBase64(file.value) | ||
emit('uploadImage', base64 as string) | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<IconContainer | ||
v-for="icon in icons" | ||
:key="icon.name" | ||
@click="handleClickOperation(icon.offset)" | ||
:class="icon.className" | ||
> | ||
<Icon :icon="icon.name" /> | ||
<p v-if="icon.offset > 0" class="text-xs">{{ props.opacity }} %</p> | ||
</IconContainer> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
import IconContainer from '@/components/icons/IconContainer.vue' | ||
import { Icon } from '@iconify/vue' | ||
type Icon = { | ||
offset: number | ||
name: string | ||
className: string[] | string | ||
} | ||
const props = defineProps<{ opacity: number }>() | ||
const emit = defineEmits<{ | ||
(e: 'operation', offset: number): void | ||
}>() | ||
const icons = computed<Array<Icon>>(() => { | ||
const disabledClassName = ['opacity-50', 'cursor-not-allowed'] | ||
return [ | ||
{ | ||
offset: 10, | ||
name: 'mdi:eye-plus-outline', | ||
className: props.opacity >= 100 ? disabledClassName : '' | ||
}, | ||
{ | ||
offset: -10, | ||
name: 'mdi:eye-minus-outline', | ||
className: props.opacity <= 0 ? disabledClassName : '' | ||
} | ||
] | ||
}) | ||
const handleClickOperation = (offset: number) => { | ||
if (offset > 0 && props.opacity === 100) return | ||
if (offset < 0 && props.opacity === 0) return | ||
emit('operation', offset) | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
<template> | ||
<button> | ||
<IconSetting> | ||
<Icon :icon="`uil:setting`" /> | ||
</button> | ||
</IconSetting> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import IconSetting from '@/components/icons/IconSetting.vue' | ||
import { Icon } from '@iconify/vue' | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.