-
Notifications
You must be signed in to change notification settings - Fork 165
Conversation
… Added new example. Added action header.
``` | ||
|
||
Note: This component has an i18n dependency that requires setup per [these steps](https://github.com/cerner/terra-core/#internationalization-i18n). |
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.
When trying to get ActionHeader working, I ran into issues because I didn't realize the need for Base as an ancestor. I wanted to include a link and brief description here to help future consumers avoid this confusion, too. Any tips on better wording appreciated.
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render header & footer', () => { |
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.
Talked with Neal and Brett last week. Footer is required, so don't need the special test cases with and without.
@@ -13,9 +13,22 @@ Dialogs are temporary views that can be used in a myriad of ways. Dialogs have t | |||
import React from 'react'; | |||
import Dialog from 'terra-dialog'; | |||
|
|||
<Dialog header="Header Content" footer="Footer Content">some body content</Dialog> | |||
const header = 'Header Content'; | |||
|
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.
It'd be great if we can get this API consistent. Ex: Since header doesn't require a wrapper, do we need them for body and footer?
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 suppose it depends on what you mean by "need." I didn't create one for header because ActionHeader is already the wrapper.
The wrappers were suggested by Brett, so I will discuss this with him when he gets in.
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'm thinking put the wrappers inside the Dialog, and the content will just populate the wrappers in the dialog.
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, thinking on this some more that makes sense. For the dialog subcomponets, like<Dialog.Body>
, these will switch to an internal implementation. Likely <div className={dialogBodyClasses}>{dialogBody}</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.
packages/terra-dialog/src/Dialog.jsx
Outdated
* The footer element to be placed within the footer area of the dialog. | ||
* The footer content area will not display if this prop is not provided. UNDER EVALUATION | ||
*/ | ||
footer: PropTypes.node.isRequired, |
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.
Remove the isRequired part, since it doesn't sound like it's required.
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.
Actually, I forgot to update the doc. The footer is required now.
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.
packages/terra-dialog/src/Dialog.jsx
Outdated
footer: PropTypes.node.isRequired, | ||
/** | ||
* The children to be placed within the main content area of the dialog. | ||
*/ | ||
children: PropTypes.node.isRequired, |
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'd make this optional as well to be honest.
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.
What is a dialog with no content? Seems...wrong.
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.
It does and I'm sure it's an unlikely case, but it's still an edge case that I'd feel safer having than not. I know for table cells that api is a little confusing in that you can't have an empty table cell.
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 don't know. That seems like a different situation, in that an empty table cell feels appropriate. That signifies "No data point" rather than "No content".
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 can't think of a case where we'd have a model without children content. Thats's not to say its not a valid case, but I think we can move forward with this as-is. If we come across the use-case, we'll re-evaluate.
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.
But if a developer passes in null or no children, does it change the display logic of the component? If the dialog can't display if this is null or empty, I'm fine leaving it as required. However, it the dialog handles fine with null or empty children, I still vote to drop the isRequired off this prop. It doesn't change our implementation logic, but still allows for our API to handle that edge case.
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 conversation is dumb and not important. I have removed the required flag because the impact in either direction is minimal and not worth the effort already invested in the discussion.
packages/terra-dialog/src/Dialog.jsx
Outdated
}; | ||
|
||
const Dialog = ({ header, footer, children }) => { | ||
const defaultProps = { | ||
header: null, |
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.
Anything required doesn't need a defaultProp I believe.
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.
@@ -3,4 +3,19 @@ | |||
height: 100%; | |||
width: 100%; | |||
} | |||
|
|||
.header { // May not be needed if action header is already themeable. |
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.
In my opinion, I would still theme it. Terra-time-input had to apply individual styles to all of it's buttons and inputs so that it would all be aligned with each other.
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.
} | ||
|
||
.dialog-body { | ||
background-color: var(--terra-dialog-body-background-color, transparent); |
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.
How about the foreground? Typically, when you set a background, you also need to set a foreground. Or will that be handled by another component?
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.
]); | ||
|
||
return ( | ||
<div className={DialogBodyClassNames}> |
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 should probably still provide the support for custom props on this component.
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.
import React from 'react'; | ||
import Dialog from 'terra-dialog'; | ||
|
||
const header = <span>Header Stuff</span>; | ||
const header = 'Header Stuff'; |
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.
If it's possible, it would be better if we allowed this to take in react nodes as well. With react nodes, you can build components that easily let you opt in and out of overflowing text
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.
Can't. This gets passed into ActionHeader, which requires String.
const body = (<Dialog.Body> | ||
<p>This is my body content.</p> | ||
<p>This is some more content.</p> | ||
</Dialog.Body>); | ||
|
||
const DialogDefault = () => ( | ||
<div style={{ height: '200px', width: '350px', border: 'dashed' }}> |
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.
Given how large this hash is, I think it's best to extract it to a CSS file. Also, should the border be themeable? @neilpfeiffer
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.
Disregard. This is an example page.
@@ -32,6 +32,7 @@ | |||
"classnames": "^2.2.5", | |||
"prop-types": "^15.5.8", | |||
"terra-base": "^2.0.0", | |||
"terra-clinical-action-header": "^1.6.0", |
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.
Talked with @mjhenkes on this some, and we believe that it might be ideal to move action header to the core repository. terra-core was the building blocks for repos such as terra-clinical and terra-consumer, so it feels like a circular dependency when terra-core relies on stuff set inside one of the repos that extend off of this one.
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.
Talked in Scrum. Current decision is to move forward with this review and add themes to the component in Clinical. Later, we are going to evaluate deprecating the clinical ActionHeader and including a new one in core.
}; | ||
|
||
const DialogBody = ({ children }) => { | ||
const DialogBodyClassNames = cx([ |
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 variable should probably be camelCase
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.
…com/cerner/terra-core into CWELL-15317-theme-and-action-header
packages/terra-modal/src/Modal.scss
Outdated
background-color: #fff; | ||
border-radius: 5px; | ||
background-color: var(--terra-modal-background-color, #fff); | ||
border: var(--terra-modal-border, none); |
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.
If there is no property value for default theme, lets drop the fallback value for these theming properties.
e.g. switch border: var(--terra-modal-border, none);
to border: var(--terra-modal-border);
Looks like this can be done for the following
- border
- box-shadow
- color
- height
- margin
- max-width
- width
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.
…com/cerner/terra-core into CWELL-15317-theme-and-action-header
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.
Looks good. My only last request is to see if we can reduce the size of those screenshots possibly. toMatchScreenshot can take a screenshot for a given selector, which we could probably get from the dialog wrapper.
Functional verification completed. The dialog examples display and function correctly with the action header changes applied. |
.dialog-header { | ||
background-color: var(--terra-dialog-header-background-color, transparent); | ||
border-bottom: var(--terra-dialog-header-bottom-border, none); | ||
color: var(--terra-dialog-header-foreground-color, #000); |
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.
@saedar - Minor color updates:
.dialog-header {
color: var(--terra-dialog-header-foreground-color, #1c1f21);
}
.dialog-body {
color: var(--terra-dialog-body-foreground-color, #1c1f21);
}
.dialog-footer {
border-top: var(--terra-dialog-footer-bottom-top, 1px solid #dedfe0);
color: var(--terra-dialog-footer-foreground-color, #1c1f21);
}
Tested: PR #1209
|
Resolves: #1157
Summary
Dialog has been updated to consume ActionHeader. I have also added theme variables to Dialog, Modal, and ModalOverlay.
Deployment URL
https://terra-core-deployed-pr-1209.herokuapp.com/static/#/site/dialog
I also updated Dialog to use subcomponents for body and footer. Since I am having to pass the header/footer/body content to ContentContainer via props, I was unsure if how I have it currently working is the best approach. If not, I welcome tips on a better path.
EDIT: Subcomponent implementation has been removed for simplicity.
@cerner/terra