-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SharedUX] Migrate PageTemplate > NoData Page #128372
Conversation
@elasticmachine merge upstream |
export type NoDataPageActions = Partial<EuiCardProps> & { | ||
/** | ||
* Provide just a string for the button's label, or a whole component | ||
*/ | ||
button?: string | ReactNode; | ||
/** | ||
* Remapping `onClick` to any element | ||
*/ | ||
onClick?: MouseEventHandler<HTMLElement>; | ||
/** | ||
* Category to auto-select within Fleet | ||
*/ | ||
category?: 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.
These are actually extending ElasticAgentCardProps
without the description
. Maybe we can just extend otherwise we'll need to keep the props and descriptions in sync?
export type NoDataPageActions = Partial<EuiCardProps> & { | |
/** | |
* Provide just a string for the button's label, or a whole component | |
*/ | |
button?: string | ReactNode; | |
/** | |
* Remapping `onClick` to any element | |
*/ | |
onClick?: MouseEventHandler<HTMLElement>; | |
/** | |
* Category to auto-select within Fleet | |
*/ | |
category?: string; | |
}; | |
export type NoDataPageActions = Omit<ElasticAgentCardProps, 'description'>; |
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.
Fixed!
const actionCard = <div key={'action'}>{el}</div>; | ||
test('render', () => { | ||
const component = shallowWithIntl( | ||
<NoDataPageBody solution="Elastic" docsLink="test" actionCard={actionCard} logo={'elastic'} /> |
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.
<NoDataPageBody solution="Elastic" docsLink="test" actionCard={actionCard} logo={'elastic'} /> | |
<NoDataPageBody solution="Analytics" docsLink="test" actionCard={actionCard} logo={'logoKibana'} /> |
<EuiSpacer | ||
size="l" | ||
/> | ||
<h1 /> |
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.
Hm, looks like we should either be requiring a pageTitle
in NoDataPageBody or ensuring an empty h1
is not rendered if there is no pageTitle
.
<div {...rest}> | ||
<NoDataPageBody | ||
pageTitle={title} | ||
actionCard={actionCard} | ||
logo={logo} | ||
solution={solution} | ||
docsLink={docsLink} | ||
/> | ||
</div> |
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.
To be honest, do we really need this component? All it's doing is some string creation and passing it along to the NoDataPageBody component that needs them to render properly anyway. Seems like it's an extra wrapper that is no longer necessary and we can just move all the title stuff directly into NoDataPageBody.
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 hope you meant the other way around 😅 I removed the NoDataPageBody
component, making it all part of NoDataPage
component. This also fixed the issue with the title, as it turns out we were already setting a default title in there in case none was provided.
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.
Yeah either way really. The NoDataPage
at this time didn't have much in it
</EuiTextColor> | ||
</EuiText> | ||
<EuiSpacer size="xxl" /> | ||
{actionCard} |
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.
We need to add margin-inline: auto
to the card itself to ensure it gets centered horizontally.
@elasticmachine merge upstream |
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.
LGTM. I did notice we have some issues in Storybook with custom styles and dark mode which I mentioned in the storybook slack channel.
I just had one extra suggestion for another control, but mergeable either way.
}; | ||
|
||
PureComponent.argTypes = { | ||
solution: { |
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.
Suggestion: Can we add a logo
control that is blank by default?
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.
Done!
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Summary
This PR migrates
NoDataPage
fromkibana_react
toshared_ux
. After an offline sync with @cchaos, there are a few notable changes:ElasticAgentCard
, notNoDataCard
as previously. This has also been updated in props definition (but leavingNoData
card now in the repo for now, will be removed in a subsequent PR)recommended
prop on the card is not needed and it won't be usedChecklist
Delete any items that are not applicable to this PR.
Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
For maintainers