From c75bf1c319345ab946e93f6a8759538d6f89ebca Mon Sep 17 00:00:00 2001 From: norman-andrians Date: Sat, 9 Mar 2024 16:05:08 +0700 Subject: [PATCH] piezo buzzer --- src/components/ControlSection.tsx | 8 ++- src/components/forms/Button.tsx | 43 +++++++++++-- src/components/forms/EvoInput.tsx | 6 +- src/components/forms/PinBox.tsx | 57 ++++++++++++------ src/components/landing/ControlLED.tsx | 8 ++- src/components/landing/ControlPiezo.tsx | 77 ++++++++++++++++++++++++ src/components/landing/ControlRgbLed.tsx | 18 +++--- src/components/landing/Hero.tsx | 18 ++++-- src/contexts/BoardController.tsx | 7 ++- src/hooks/index.tsx | 41 ++++++++++++- src/pages/MainPage.tsx | 12 +++- 11 files changed, 245 insertions(+), 50 deletions(-) create mode 100644 src/components/landing/ControlPiezo.tsx diff --git a/src/components/ControlSection.tsx b/src/components/ControlSection.tsx index 27574f2..d2fde3b 100644 --- a/src/components/ControlSection.tsx +++ b/src/components/ControlSection.tsx @@ -1,22 +1,24 @@ -import { ReactNode } from "react"; +import { ReactNode, Ref } from "react"; interface ControlSectionProps { title: string; description?: string; id?: string; + refto?: Ref stack: ReactNode; colSpan?: number; - stackType?: 'grid' | 'flex' + stackType?: 'grid' | 'flex'; } export default function ControlSection ({ title, description, id, + refto, stack }: ControlSectionProps) { return ( -
+

diff --git a/src/components/forms/Button.tsx b/src/components/forms/Button.tsx index b3a8e9a..7f3458c 100644 --- a/src/components/forms/Button.tsx +++ b/src/components/forms/Button.tsx @@ -1,18 +1,33 @@ import { CSSProperties, MouseEventHandler, ReactNode } from "react"; -interface InButton { +interface ButtonProps { className?: string; style?: CSSProperties, onClick?: MouseEventHandler children?: ReactNode } -export default function Button ({ +function Primary ({ className, style, onClick, children -}: InButton) { +}: ButtonProps) { + return ( + + ) +} + +function Secondary ({ + className, + style, + onClick, + children +}: ButtonProps) { return ( ) -} \ No newline at end of file +} + +function Button ({ + className, + style, + onClick, + children +}: ButtonProps) { + return ( + + ) +} + +Button.Primary = Primary; +Button.Secondary = Secondary; + +export default Button; \ No newline at end of file diff --git a/src/components/forms/EvoInput.tsx b/src/components/forms/EvoInput.tsx index 5797456..2e8b7a9 100644 --- a/src/components/forms/EvoInput.tsx +++ b/src/components/forms/EvoInput.tsx @@ -22,10 +22,10 @@ export default function EvoInput ({ } return ( -