From 9f95d30885b8ea06d17e8a2a3e9a287ce9307465 Mon Sep 17 00:00:00 2001 From: gitdallas Date: Thu, 5 Oct 2023 12:39:07 -0500 Subject: [PATCH 1/2] feat(ClipboardCopy): 9712 allow alternative title --- .../src/components/ClipboardCopy/ClipboardCopy.tsx | 9 +++++++-- .../ClipboardCopy/examples/ClipboardCopy.md | 5 +++++ .../examples/ClipboardCopyExpandedWithAltTitle.tsx | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 packages/react-core/src/components/ClipboardCopy/examples/ClipboardCopyExpandedWithAltTitle.tsx diff --git a/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx b/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx index bb70d7af704..d18b6a29c4e 100644 --- a/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx +++ b/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx @@ -47,6 +47,8 @@ export interface ClipboardCopyProps extends Omit isBlock?: boolean; /** Adds Clipboard Copy variant styles. */ variant?: typeof ClipboardCopyVariant | 'inline' | 'expansion' | 'inline-compact'; + /** Replaces the textinput text, useful for expansion variant when you want to provide a summary of the text that will be copied. Will force isReadOnly on the textInput part. */ + title?: string; /** Copy button tooltip position. */ position?: | TooltipPosition @@ -104,6 +106,7 @@ class ClipboardCopy extends React.Component )} ( + + Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting + expansion. + +); From af15759337958bee14e65cc9729f804f63d9e117 Mon Sep 17 00:00:00 2001 From: gitdallas Date: Thu, 5 Oct 2023 13:16:02 -0500 Subject: [PATCH 2/2] add some descriptive text in the example --- .../examples/ClipboardCopyExpandedWithAltTitle.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-core/src/components/ClipboardCopy/examples/ClipboardCopyExpandedWithAltTitle.tsx b/packages/react-core/src/components/ClipboardCopy/examples/ClipboardCopyExpandedWithAltTitle.tsx index fe870c20538..d03caf857a8 100644 --- a/packages/react-core/src/components/ClipboardCopy/examples/ClipboardCopyExpandedWithAltTitle.tsx +++ b/packages/react-core/src/components/ClipboardCopy/examples/ClipboardCopyExpandedWithAltTitle.tsx @@ -8,7 +8,9 @@ export const ClipboardCopyExpanded: React.FunctionComponent = () => ( clickTip="Copied" variant={ClipboardCopyVariant.expansion} > - Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting - expansion. + This could be a lot of information that you'd want to summarize with a title as above. The title above will be + readonly as it was defined as a title rather than just the first part of this text. However, a user can still modify + this content which gets copied into the clipboard. You can use the isReadOnly flag to prevent them from changing + this. );