-
Notifications
You must be signed in to change notification settings - Fork 15
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
added a subheading and copy button to the pagewithtabs component #1450
Conversation
ARADDCC002
commented
Aug 5, 2024
@@ -56,9 +56,11 @@ export default function DataCard() { | |||
<PageWithTabs | |||
showCopyButton | |||
title={dataCard.name} | |||
subheading={`ID: ${dataCard.id}`} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
frontend/src/common/PageWithTabs.tsx
Outdated
<CopyToClipboardButton | ||
textToCopy={subheadingToCopy ? subheadingToCopy : subheading} | ||
notificationText='Copied to clipboard' | ||
ariaLabel='copy to clipboard' | ||
/> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!