Archipelago — open-source initial import
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div :class="currentTheme">
|
||||
<WidgetFab
|
||||
:is-open="isOpen"
|
||||
:position="fabPosition"
|
||||
@toggle="isOpen = !isOpen"
|
||||
/>
|
||||
<WidgetModal
|
||||
:is-open="isOpen"
|
||||
:side="side"
|
||||
@close="isOpen = false"
|
||||
@switch-side="toggleSide"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { useTheme } from '@/composables/useTheme'
|
||||
import WidgetFab from './WidgetFab.vue'
|
||||
import WidgetModal from './WidgetModal.vue'
|
||||
|
||||
const { currentTheme } = useTheme()
|
||||
|
||||
const isOpen = ref(false)
|
||||
const side = ref<'left' | 'right'>('right')
|
||||
|
||||
const fabPosition = computed(() =>
|
||||
side.value === 'left' ? 'bottom-left' : 'bottom-right'
|
||||
)
|
||||
|
||||
function toggleSide() {
|
||||
side.value = side.value === 'right' ? 'left' : 'right'
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<button
|
||||
class="fixed z-50 w-14 h-14 rounded-full path-glass-button flex items-center justify-center
|
||||
transition-all duration-300 hover:scale-105 active:scale-95"
|
||||
:class="positionClasses"
|
||||
:style="{ boxShadow: '0 8px 24px rgba(0, 0, 0, 0.45), 0 0 20px rgba(247, 147, 26, 0.15)' }"
|
||||
:aria-label="isOpen ? 'Close AIUI' : 'Open AIUI'"
|
||||
@click="$emit('toggle')"
|
||||
>
|
||||
<svg
|
||||
class="w-6 h-6 text-accent transition-transform duration-300"
|
||||
:class="isOpen ? 'rotate-45' : ''"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
v-if="!isOpen"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"
|
||||
/>
|
||||
<path
|
||||
v-else
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M12 4v16m8-8H4"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
isOpen: boolean
|
||||
position?: 'bottom-right' | 'bottom-left'
|
||||
}>(),
|
||||
{ position: 'bottom-right' }
|
||||
)
|
||||
|
||||
defineEmits<{ toggle: [] }>()
|
||||
|
||||
const positionClasses = computed(() =>
|
||||
props.position === 'bottom-left'
|
||||
? 'bottom-6 left-6'
|
||||
: 'bottom-6 right-6'
|
||||
)
|
||||
</script>
|
||||
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="widget">
|
||||
<div
|
||||
v-if="isOpen"
|
||||
class="fixed z-40 animate-scale-in"
|
||||
:class="[positionClasses, currentTheme]"
|
||||
>
|
||||
<div
|
||||
class="w-[380px] h-[600px] md:w-[420px] md:h-[640px] path-glass-card overflow-hidden"
|
||||
:style="isDark
|
||||
? 'box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(247, 147, 26, 0.06)'
|
||||
: 'box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 0 40px rgba(247, 147, 26, 0.04)'"
|
||||
>
|
||||
<ChatWindow
|
||||
variant="modal"
|
||||
:side="side"
|
||||
show-close
|
||||
@switch-side="$emit('switchSide')"
|
||||
@close="$emit('close')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useTheme } from '@/composables/useTheme'
|
||||
import ChatWindow from '@/components/chat/ChatWindow.vue'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
isOpen: boolean
|
||||
side?: 'left' | 'right'
|
||||
}>(),
|
||||
{ side: 'right' }
|
||||
)
|
||||
|
||||
defineEmits<{
|
||||
close: []
|
||||
switchSide: []
|
||||
}>()
|
||||
|
||||
const { isDark, currentTheme } = useTheme()
|
||||
|
||||
const positionClasses = computed(() =>
|
||||
props.side === 'left'
|
||||
? 'bottom-24 left-6'
|
||||
: 'bottom-24 right-6'
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.widget-enter-active {
|
||||
transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
|
||||
}
|
||||
.widget-leave-active {
|
||||
transition: all 0.2s ease-in;
|
||||
}
|
||||
.widget-enter-from {
|
||||
opacity: 0;
|
||||
transform: scale(0.9) translateY(20px);
|
||||
}
|
||||
.widget-leave-to {
|
||||
opacity: 0;
|
||||
transform: scale(0.9) translateY(20px);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user