Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

fix(Dropdown): Support for configuring dropdown offset #17

Merged
merged 7 commits into from
Feb 15, 2019

Conversation

cehsu
Copy link
Contributor

@cehsu cehsu commented Feb 14, 2019

The redesigned EMR dashboard requires the following properties of the dropdown component to be configurable: border-radius, border, offset.

Related CMS PR: https://github.com/sappira-inc/cms/pull/225

Tested locally via yarn docs
image

@cehsu cehsu requested a review from a team February 14, 2019 20:42
@codecov-io
Copy link

codecov-io commented Feb 14, 2019

Codecov Report

Merging #17 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #17   +/-   ##
=======================================
  Coverage   74.21%   74.21%           
=======================================
  Files          13       13           
  Lines         159      159           
  Branches       24       23    -1     
=======================================
  Hits          118      118           
- Misses         30       31    +1     
+ Partials       11       10    -1
Impacted Files Coverage Δ
src/Dropdown/Dropdown.js 41.86% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1614e4...144431f. Read the comment docs.

@@ -71,7 +72,7 @@ export default class Dropdown extends React.Component {
}

show = () => {
const { placement, boundariesElement } = this.props;
const { offset = '0, 10', placement, boundariesElement } = this.props;

Choose a reason for hiding this comment

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

add offset to propTypes and defaultProps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @choochootrain, great idea. Updated.

@@ -42,6 +42,7 @@ export default class Dropdown extends React.Component {
placement: 'bottom-start',
boundariesElement: 'window',
on: 'click',
border: true,

Choose a reason for hiding this comment

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

add default for boxShadow?

@kylealwyn
Copy link
Contributor

Can we just configure the dropdown styles in cms theme.js?

@cehsu
Copy link
Contributor Author

cehsu commented Feb 14, 2019

Thanks @kylealwyn, that's a better approach -- we can specify the styles in theme instead. An offset will still need to be passed down in order to specify how Popper.js will handle/calculate placement.

@cehsu cehsu changed the title Configure dropdown border-radius, border, offset Configure dropdown offset Feb 14, 2019
@@ -82,7 +86,7 @@ export default class Dropdown extends React.Component {
placement,
modifiers: {
offset: {
offset: '0, 10',
Copy link
Contributor

@kylealwyn kylealwyn Feb 15, 2019

Choose a reason for hiding this comment

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

Does this need to be offset: this.props.offset? Or pull out offset from props spread on L78

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! That was the intention, thanks for catching the oversight, fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Was this tested locally? Browser would've thrown

Copy link
Contributor Author

@cehsu cehsu Feb 15, 2019

Choose a reason for hiding this comment

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

I hadn't tested it locally, is something like yalc the best tool for that? Or by running the docs command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reminder Kyle, screenshot added to description above. (I had been testing the changes locally by editing the molekule.es.js file in cms/node_modules, and had forgotten to copy over the assignment.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you found yarn docs :)

Copy link
Contributor

@kylealwyn kylealwyn left a comment

Choose a reason for hiding this comment

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

looks legit

@kylealwyn kylealwyn changed the title Configure dropdown offset fix(Dropdown): Support for configuring dropdown offset Feb 15, 2019
@cehsu cehsu merged commit c739ff3 into master Feb 15, 2019
@cehsu cehsu deleted the fix/dropdown-min-width branch February 15, 2019 17:58
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.

4 participants