From 2a6c10b6620fca9c56f92c8cf45881bb272106f4 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 1 May 2026 00:30:50 +0200 Subject: [PATCH] add ui sounds to button --- package.json | 2 +- src/button.tsx | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7edca2f..596379b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@avocadi/ui", "type": "module", - "version": "0.2.6", + "version": "0.2.7", "private": false, "files": [ "dist" diff --git a/src/button.tsx b/src/button.tsx index 1c41663..4f39440 100644 --- a/src/button.tsx +++ b/src/button.tsx @@ -4,6 +4,7 @@ import { type MotionProps, motion } from "motion/react"; import type * as React from "react"; import type { ComponentProps, FC } from "react"; import { cn } from "@/lib/utils"; +import useInterfaceSound from "./hooks/useInterfaceSound"; const buttonVariants = cva( "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-color \ @@ -44,6 +45,9 @@ function Button({ variant, size, asChild = false, + onClick, + onMouseEnter, + onMouseLeave, ...props }: React.ComponentProps<"button"> & VariantProps & { @@ -51,10 +55,20 @@ function Button({ }) { const Comp = asChild ? Slot : "button"; + const { play } = useInterfaceSound(); + return ( { + onClick?.(e); + play({ id: "click1" }); + }} + onMouseEnter={(e) => { + play({ id: "click2" }); + onMouseEnter?.(e); + }} {...props} /> );