Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a subheading and copy button to the pagewithtabs component #1450

Merged

Conversation

ARADDCC002
Copy link
Member

image

@@ -56,9 +56,11 @@ export default function DataCard() {
<PageWithTabs
showCopyButton
title={dataCard.name}
subheading={`ID: ${dataCard.id}`}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we wan't the same with Access Requests and Schemas?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't use this component in the same way - the Schemas page for example just uses the static title "Schemas", the reason we need this change for entries is because they have dynamic names and IDs

sourceModelId = '',
}: {
title: string
subheading?: string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this as an optional type looks like a typo?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a typo - we don't always need a subheading eg the schemas page.

tabs: PageTab[]
actionButtonTitle?: string
displayActionButton?: boolean
actionButtonOnClick?: () => void
requiredUrlParams?: ParsedUrlQuery
showCopyButton?: boolean
textToCopy?: string
titleToCopy?: string
subheadingToCopy?: string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to have extra ...ToCopy props since they're likely just repeats of existing props? I realise it's done this way already with the title?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something I thought about, and you are right when it comes to the title for models and data cards, but it's slightly different for the subheading. In my current implementation, the subheading is "ID: my-model-123", but I don't want to copy to clipboard the bit that says "ID:". Equally, we don't want to hard code "ID:" into the PageWithTabs component, because subheadings might not always be IDs, they can be any string value.

Comment on lines 145 to 149
<CopyToClipboardButton
textToCopy={subheadingToCopy ? subheadingToCopy : subheading}
notificationText='Copied to clipboard'
ariaLabel='copy to clipboard'
/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this component need to be conditional on showCopyButton, like with the title page?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does, good spot!

@ARADDCC002 ARADDCC002 merged commit 3b863c1 into main Aug 5, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants