Basic implementation for anime page

This commit is contained in:
2026-01-18 00:46:32 +05:00
parent da573b6b33
commit 7390c631d5
31 changed files with 846 additions and 162 deletions

View File

@ -4,6 +4,7 @@ import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { TooltipArrow, TooltipContent, TooltipPortal, useForwardPropsEmits } from "reka-ui"
import { cn } from "@/lib/utils"
import { tooltipArrowVariants, tooltipContentVariants, type TooltipArrowVariants, type TooltipContentVariants } from "."
defineOptions({
inheritAttrs: false,
@ -13,6 +14,8 @@ interface Props {
includeArrow?: boolean
class?: HTMLAttributes["class"]
arrowClass?: HTMLAttributes["class"]
tooltipColor?: TooltipContentVariants["color"]
tooltipArrowColor?: TooltipArrowVariants["color"]
}
const props = withDefaults(defineProps<TooltipContentProps & Props>(), {
@ -29,11 +32,11 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
<template>
<TooltipPortal>
<TooltipContent data-slot="tooltip-content" v-bind="{ ...forwarded, ...$attrs }"
:class="cn('bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance', props.class)">
:class="cn(tooltipContentVariants({ variant: 'default', color: tooltipColor }), props.class)">
<slot />
<TooltipArrow
:class="cn('bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]', arrowClass)"
:class="cn(tooltipArrowVariants({ variant: 'default', color: tooltipArrowColor }), arrowClass)"
v-if="includeArrow" />
</TooltipContent>
</TooltipPortal>

View File

@ -2,3 +2,48 @@ export { default as Tooltip } from "./Tooltip.vue"
export { default as TooltipContent } from "./TooltipContent.vue"
export { default as TooltipProvider } from "./TooltipProvider.vue"
export { default as TooltipTrigger } from "./TooltipTrigger.vue"
import type { VariantProps } from "class-variance-authority"
import { cva } from "class-variance-authority"
export const tooltipContentVariants = cva(
"text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance",
{
variants: {
variant: {
default: ""
},
color: {
default: "bg-foreground",
muted: "bg-muted text-muted-foreground"
}
},
defaultVariants: {
variant: "default",
color: "default",
},
}
)
export const tooltipArrowVariants = cva(
"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]",
{
variants: {
variant: {
default: ""
},
color: {
default: "bg-foreground fill-foreground",
muted: "bg-muted fill-muted"
}
},
defaultVariants: {
variant: "default",
color: "default"
}
},
)
export type TooltipContentVariants = VariantProps<typeof tooltipContentVariants>
export type TooltipArrowVariants = VariantProps<typeof tooltipArrowVariants>