mirror of
https://github.com/versia-pub/frontend.git
synced 2026-06-14 15:39:15 +02:00
refactor: ♻️ Redesign post composer
This commit is contained in:
parent
ef7475aead
commit
7ff9d2302a
17 changed files with 327 additions and 203 deletions
39
app/components/ui/input-group/InputGroupAddon.vue
Normal file
39
app/components/ui/input-group/InputGroupAddon.vue
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { InputGroupVariants } from ".";
|
||||
import { inputGroupAddonVariants } from ".";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
align?: InputGroupVariants["align"];
|
||||
class?: HTMLAttributes["class"];
|
||||
}>(),
|
||||
{
|
||||
align: "inline-start",
|
||||
},
|
||||
);
|
||||
|
||||
function handleInputGroupAddonClick(e: MouseEvent) {
|
||||
const currentTarget = e.currentTarget as HTMLElement | null;
|
||||
const target = e.target as HTMLElement | null;
|
||||
if (target?.closest("button")) {
|
||||
return;
|
||||
}
|
||||
if (currentTarget?.parentElement) {
|
||||
currentTarget.parentElement?.querySelector("input")?.focus();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
role="group"
|
||||
data-slot="input-group-addon"
|
||||
:data-align="props.align"
|
||||
:class="cn(inputGroupAddonVariants({ align: props.align }), props.class)"
|
||||
@click="handleInputGroupAddonClick"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue