From db41d20e99e93743f281172f6b993a810fad84e9 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 13 Jul 2022 11:35:39 +0200 Subject: [PATCH] chore: slight refactor Signed-off-by: blam --- packages/core-components/api-report.md | 1 + .../components/CopyTextButton/CopyTextButton.tsx | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/core-components/api-report.md b/packages/core-components/api-report.md index 302ef7ef7d..4e3820967a 100644 --- a/packages/core-components/api-report.md +++ b/packages/core-components/api-report.md @@ -190,6 +190,7 @@ export function CopyTextButton(props: CopyTextButtonProps): JSX.Element; // @public export interface CopyTextButtonProps { + 'aria-label'?: string; text: string; tooltipDelay?: number; tooltipText?: string; diff --git a/packages/core-components/src/components/CopyTextButton/CopyTextButton.tsx b/packages/core-components/src/components/CopyTextButton/CopyTextButton.tsx index 2a6543b9cd..bd900a931d 100644 --- a/packages/core-components/src/components/CopyTextButton/CopyTextButton.tsx +++ b/packages/core-components/src/components/CopyTextButton/CopyTextButton.tsx @@ -47,11 +47,16 @@ export interface CopyTextButtonProps { * Default: "Text copied to clipboard" */ tooltipText?: string; -} -type LabelledCopyTextButtonProps = CopyTextButtonProps & { + /** + * Text to use as aria-label prop on the button + * + * @remarks + * + * Default: "Copy text" + */ 'aria-label'?: string; -}; +} /** * Copy text button with visual feedback @@ -72,7 +77,7 @@ type LabelledCopyTextButtonProps = CopyTextButtonProps & { * arial-label="Accessible label for this button" /> * ``` */ -export function CopyTextButton(props: LabelledCopyTextButtonProps) { +export function CopyTextButton(props: CopyTextButtonProps) { const { text, tooltipDelay = 1000,