Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Label Value View Implementation #3

Merged
merged 8 commits into from
Apr 19, 2017
Merged

Conversation

emilyrohrbough
Copy link
Contributor

Summary

Implemented the react component LabelValueView to replace TitleValueCard.

Additional Details

The upgrade to React 15.5 is non-passive. So I locked react down at 15.4.2, as done in terra-core in this pull request.

.terraClinical-LabelValueView-label {
color: $terra-grey-50;
font-size: 1rem;
line-height: 20px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Recently we had a discussion to keep line-heights unit-less (dropping px / rem): https://css-tricks.com/almanac/properties/l/line-height/#article-header-id-0

This line-height value is also different than the one used below

Copy link
Contributor Author

@emilyrohrbough emilyrohrbough Apr 12, 2017

Choose a reason for hiding this comment

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


.terraClinical-LabelValueView-value {
font-size: 1.4285714285714286rem;
line-height: 1.4285714285714286rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

Dave brought up a good point about this styling. If a String is passed in as a value we should style it based on UX feedback, but if a component was passed in, we probably shouldn't apply a font-size and line-height.

Copy link
Contributor Author

@emilyrohrbough emilyrohrbough Apr 12, 2017

Choose a reason for hiding this comment

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

The current implementation uses this UX styling based on the styling sheet for the TitleValueView. As for any children (say <h1>) or components that are passed in, these styling are override. What is a better way to set these values?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we dynamically set this class in the jsx file based on what children is? If it's a solitary string we add the class, otherwise not. I'm not 100% sold on this idea so I'd like other people to weigh in as well.

Copy link
Contributor

@tbiethman tbiethman Apr 17, 2017

Choose a reason for hiding this comment

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

We could do two separate props instead of children. valueText and valueElement or valueComponent or something. I'd (personally) like to avoid type-checking props.

Or we could still use children too, something like:

<div {...customProps} className={labelValueViewClassNames}>
  <div className="terraClinical-LabelValueView-label">{props.label}</div>
  <div className="terraClinical-LabelValueView-value">{props.valueText}</div>
  {children}
</div>

We'd just need to document that valueText will be styled a certain way, and that children could be used for more substantial components.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm cool with Tyler's suggestion. I definitely would like to see this addressed before it gets merged in.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 To Tyler's suggestion of having a prop for value but keeping children, I would conditionally render the value wrapper.

The Button does something similar: https://github.com/cerner/terra-core/blob/master/packages/terra-button/src/Button.jsx#L73

When trying to render null nothing happens.

"main": "lib/LabelValueView.js",
"private": true,
"version": "0.0.0",
"description": "terra-clinical-label-value-view",
Copy link
Contributor

Choose a reason for hiding this comment

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

A description should be added here, most people copy paste the description from the readme

Copy link
Contributor Author

@emilyrohrbough emilyrohrbough Apr 12, 2017

Choose a reason for hiding this comment

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

@emilyrohrbough emilyrohrbough force-pushed the terra-clinical-label-value-view branch from 5e8c824 to 75323ee Compare April 12, 2017 18:14
/**
* Child component(s) to display underneath the label.
*/
children: PropTypes.element,
Copy link
Contributor

Choose a reason for hiding this comment

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

I would keep children as type node

Copy link
Contributor Author

@emilyrohrbough emilyrohrbough Apr 18, 2017

Choose a reason for hiding this comment

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

Yeah, I wasn't sure when I changed this. Changed Back Here

@emilyrohrbough emilyrohrbough force-pushed the terra-clinical-label-value-view branch from be4eaac to 108af78 Compare April 18, 2017 15:13
@mjhenkes mjhenkes merged commit 080b9b3 into master Apr 19, 2017
@mjhenkes mjhenkes deleted the terra-clinical-label-value-view branch April 19, 2017 19:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants