feat: add Surface, Link and Spinner components
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import { provide, computed, useAttrs } from "vue";
|
||||
import { surfaceVariants, type SurfaceVariants } from "@heroui-vue/styles";
|
||||
import { surfaceContextKey } from "./context";
|
||||
|
||||
defineOptions({ inheritAttrs: false });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
variant?: SurfaceVariants["variant"];
|
||||
}>(),
|
||||
{ variant: "default" },
|
||||
);
|
||||
|
||||
const attrs = useAttrs();
|
||||
const variant = computed(() => props.variant ?? "default");
|
||||
|
||||
provide(surfaceContextKey, { variant });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-bind="attrs" :class="surfaceVariants({ variant })" data-slot="surface">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { ComputedRef, InjectionKey } from "vue";
|
||||
import type { SurfaceVariants } from "@heroui-vue/styles";
|
||||
|
||||
export interface SurfaceContext {
|
||||
variant: ComputedRef<SurfaceVariants["variant"]>;
|
||||
}
|
||||
|
||||
export const surfaceContextKey: InjectionKey<SurfaceContext> =
|
||||
Symbol("HeroUIVue.Surface");
|
||||
Reference in New Issue
Block a user