From 2fad21fede85dae0b6769d50bd3081a8d902e2a9 Mon Sep 17 00:00:00 2001 From: eXtranium Date: Mon, 6 Mar 2023 13:21:21 +0200 Subject: [PATCH 1/3] Added (optional) title-attribute for button element. --- components/button/Button.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/button/Button.tsx b/components/button/Button.tsx index 104e147..bd2c0c0 100644 --- a/components/button/Button.tsx +++ b/components/button/Button.tsx @@ -1,4 +1,4 @@ -// Copyright (c) 2022. Heusala Group Oy . All rights reserved. +// Copyright (c) 2023. Heusala Group Oy . All rights reserved. // Copyright (c) 2021. Sendanor . All rights reserved. import { @@ -29,6 +29,7 @@ export interface ButtonProps { readonly style ?: ButtonStyle; readonly enabled?: boolean; readonly children?: ReactNode; + readonly title?: string; } export type ButtonClickCallback = VoidCallback; @@ -41,6 +42,7 @@ export function Button (props: ButtonProps) { const hasClick = !!props?.click; const click = props?.click; const childCount = Children.count(children); + const title = props?.title ?? ''; const buttonProps: { onBlur?: any, onFocus?: any, @@ -114,6 +116,7 @@ export function Button (props: ButtonProps) { + (className ? ` ${className}` : '') } type={type} + title={title} {...buttonProps} >{children} ); From 387da2f7236e4a5161362689d2638612b0b8ff2e Mon Sep 17 00:00:00 2001 From: eXtranium Date: Thu, 9 Mar 2023 12:49:44 +0200 Subject: [PATCH 2/3] Added an "title" attribute for the component Button. This helps to extend the reactive button in one customer's project also. --- components/button/Button.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/button/Button.tsx b/components/button/Button.tsx index bd2c0c0..9b016bd 100644 --- a/components/button/Button.tsx +++ b/components/button/Button.tsx @@ -42,14 +42,14 @@ export function Button (props: ButtonProps) { const hasClick = !!props?.click; const click = props?.click; const childCount = Children.count(children); - const title = props?.title ?? ''; const buttonProps: { onBlur?: any, onFocus?: any, onKeyDown?: any, ref?: any, disabled?: any, - onClick?: any + onClick?: any, + title?: string } = {}; const blurCallback = props?.blur; @@ -77,6 +77,11 @@ export function Button (props: ButtonProps) { buttonProps.disabled = true; } + const title = props?.title; + if (title) { + buttonProps.title = title; + } + const onClick = useCallback( (event: MouseEvent) => { @@ -116,7 +121,6 @@ export function Button (props: ButtonProps) { + (className ? ` ${className}` : '') } type={type} - title={title} {...buttonProps} >{children} ); From cc9f66053d29d5ee6829961a8e11bc64426e80f3 Mon Sep 17 00:00:00 2001 From: eXtranium <83911635+eXtranium@users.noreply.github.com> Date: Thu, 9 Mar 2023 17:16:49 +0200 Subject: [PATCH 3/3] Copyright years fixed. --- components/button/Button.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/button/Button.tsx b/components/button/Button.tsx index 9b016bd..ae5d141 100644 --- a/components/button/Button.tsx +++ b/components/button/Button.tsx @@ -1,4 +1,4 @@ -// Copyright (c) 2023. Heusala Group Oy . All rights reserved. +// Copyright (c) 2022-2023. Heusala Group Oy . All rights reserved. // Copyright (c) 2021. Sendanor . All rights reserved. import {