Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

fix(Flex.Item): shrink issue#1086

Merged
kuzhelov merged 3 commits intomasterfrom
fix/flex-item-shrink
Mar 21, 2019
Merged

fix(Flex.Item): shrink issue#1086
kuzhelov merged 3 commits intomasterfrom
fix/flex-item-shrink

Conversation

@kuzhelov
Copy link
Contributor

This PR introduces fix for shrink prop of Flex.Item component. Previously value of 0 was improper interpreted, so that resulting flex item was remaining shrinkable even with this value provided

// no effect - still shrinkable :(
<Flex.Item shrink={0}>
  ...
</Flex.Item>

Copy link
Contributor

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Looks good!

@codecov
Copy link

codecov bot commented Mar 21, 2019

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1086   +/-   ##
=======================================
  Coverage   81.78%   81.78%           
=======================================
  Files         702      702           
  Lines        8580     8580           
  Branches     1172     1245   +73     
=======================================
  Hits         7017     7017           
  Misses       1548     1548           
  Partials       15       15
Impacted Files Coverage Δ
...src/themes/teams/components/Flex/flexItemStyles.ts 16.66% <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 072cf2f...54abdcf. Read the comment docs.

@kuzhelov kuzhelov merged commit a1f58c7 into master Mar 21, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix/flex-item-shrink branch March 21, 2019 11:47
...(p.size && toFlexItemSizeValues(v[p.size])),

...(p.shrink && { flexShrink: p.shrink }),
...(typeof p.shrink === 'number' && { flexShrink: p.shrink }),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this is already merged, sorry for not being able to review before that. However, there are a few things I'd like to mention.

1. what about the global values as string?

I think we should allow users to pass these too (see: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-shrink#Syntax)
image

2. what about the true boolean value?

From the new code it looks like

<Flex.Item shrink>
  {/* some element */}
</Flex.Item />

will have no effect; to me that's not expected user behavior since the type of shrink prop is still boolean | number

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me start with the second question first - yes, this is exactly the effect you've described. The logic is correct as<Flex.Item shrink /> is, essentially, equivalent to <Flex.Item />, given that flex items are shrinkable by default (we've done it to correspond to CSS specs).

Speaking of the first question - we might want to introduce support for mentioned props later, but for now extra prop values from the scope of Flex component were omitted in order to achieve the following:

address as many scenarios with the least set of props/values necessary

Thus, might suggest to leave it as is for now and return to the question of introducing these prop values (or use another solution approaches) when there will be an appealing use case for that.

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.

5 participants