-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
fix(triangle): Triangles can inherit their color #435
Closed
sgenoud
wants to merge
1
commit into
styled-components:master
from
sgenoud:fix/inherit-triangle-color
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
|
||
exports[`triangle should default to a transparent background when not passed a backgroundColor 1`] = ` | ||
Object { | ||
"borderColor": "transparent transparent transparent red", | ||
"borderColor": "transparent", | ||
"borderLeftColor": "red", | ||
"borderStyle": "solid", | ||
"borderWidth": "5px 0 5px 20px", | ||
"height": "0", | ||
|
@@ -12,7 +13,8 @@ Object { | |
|
||
exports[`triangle should generate a proper triangle when passed all parameters 1`] = ` | ||
Object { | ||
"borderColor": "black black black red", | ||
"borderColor": "black", | ||
"borderLeftColor": "red", | ||
"borderStyle": "solid", | ||
"borderWidth": "5 0 5 20", | ||
"height": "0", | ||
|
@@ -22,7 +24,8 @@ Object { | |
|
||
exports[`triangle should generate a proper triangle when passed all parameters with units on width/height 1`] = ` | ||
Object { | ||
"borderColor": "black black black red", | ||
"borderColor": "black", | ||
"borderLeftColor": "red", | ||
"borderStyle": "solid", | ||
"borderWidth": "5em 0 5em 20em", | ||
"height": "0", | ||
|
@@ -32,7 +35,8 @@ Object { | |
|
||
exports[`triangle should generate a proper triangle when passed all parameters with units on width/height with float values 1`] = ` | ||
Object { | ||
"borderColor": "black black black red", | ||
"borderColor": "black", | ||
"borderLeftColor": "red", | ||
"borderStyle": "solid", | ||
"borderWidth": "5.25em 0 5.25em 20.5em", | ||
"height": "0", | ||
|
@@ -42,7 +46,8 @@ Object { | |
|
||
exports[`triangle should generate a proper triangle when passed string values for height and width 1`] = ` | ||
Object { | ||
"borderColor": "black black black red", | ||
"borderColor": "black", | ||
"borderLeftColor": "red", | ||
"borderStyle": "solid", | ||
"borderWidth": "5px 0 5px 20px", | ||
"height": "0", | ||
|
@@ -53,7 +58,8 @@ Object { | |
exports[`triangle should properly add rules when block has existing rules 1`] = ` | ||
Object { | ||
"background": "red", | ||
"borderColor": "transparent transparent transparent grey", | ||
"borderColor": "transparent", | ||
"borderLeftColor": "grey", | ||
"borderStyle": "solid", | ||
"borderWidth": "5px 0 5px 20px", | ||
"height": "0", | ||
|
@@ -63,8 +69,9 @@ Object { | |
|
||
exports[`triangle should properly render bottom pointing arrow with red foregroundColor, width of 20px and height 20px 1`] = ` | ||
Object { | ||
"borderColor": "red transparent transparent transparent", | ||
"borderColor": "transparent", | ||
"borderStyle": "solid", | ||
"borderTopColor": "red", | ||
"borderWidth": "20px 5px 0 5px", | ||
"height": "0", | ||
"width": "0", | ||
|
@@ -73,7 +80,8 @@ Object { | |
|
||
exports[`triangle should properly render bottomLeft pointing arrow with blue foregroundColor, width of 20px and height 20px 1`] = ` | ||
Object { | ||
"borderColor": "transparent transparent transparent blue", | ||
"borderColor": "transparent", | ||
"borderLeftColor": "blue", | ||
"borderStyle": "solid", | ||
"borderWidth": "20px 0 0 20px", | ||
"height": "0", | ||
|
@@ -83,7 +91,8 @@ Object { | |
|
||
exports[`triangle should properly render bottomRight pointing arrow with blue foregroundColor, width of 20px and height 20px 1`] = ` | ||
Object { | ||
"borderColor": "transparent transparent blue transparent", | ||
"borderBottomColor": "blue", | ||
"borderColor": "transparent", | ||
"borderStyle": "solid", | ||
"borderWidth": "0 0 20px 20px", | ||
"height": "0", | ||
|
@@ -93,7 +102,8 @@ Object { | |
|
||
exports[`triangle should properly render left pointing arrow with blue foregroundColor, width of 10px and height 20px 1`] = ` | ||
Object { | ||
"borderColor": "transparent blue transparent transparent", | ||
"borderColor": "transparent", | ||
"borderRightColor": "blue", | ||
"borderStyle": "solid", | ||
"borderWidth": "10px 10px 10px 0", | ||
"height": "0", | ||
|
@@ -103,7 +113,8 @@ Object { | |
|
||
exports[`triangle should properly render right pointing arrow with width of 20px and height 10px 1`] = ` | ||
Object { | ||
"borderColor": "transparent transparent transparent red", | ||
"borderColor": "transparent", | ||
"borderLeftColor": "red", | ||
"borderStyle": "solid", | ||
"borderWidth": "5px 0 5px 20px", | ||
"height": "0", | ||
|
@@ -113,7 +124,8 @@ Object { | |
|
||
exports[`triangle should properly render top pointing arrow with green foregroundColor, width of 20px and height 20px 1`] = ` | ||
Object { | ||
"borderColor": "transparent transparent green transparent", | ||
"borderBottomColor": "green", | ||
"borderColor": "transparent", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same concern as above here. |
||
"borderStyle": "solid", | ||
"borderWidth": "0 10px 20px 10px", | ||
"height": "0", | ||
|
@@ -123,8 +135,9 @@ Object { | |
|
||
exports[`triangle should properly render topLeft pointing arrow with blue foregroundColor, width of 20px and height 20px 1`] = ` | ||
Object { | ||
"borderColor": "blue transparent transparent transparent", | ||
"borderColor": "transparent", | ||
"borderStyle": "solid", | ||
"borderTopColor": "blue", | ||
"borderWidth": "20px 20px 0 0", | ||
"height": "0", | ||
"width": "0", | ||
|
@@ -133,7 +146,8 @@ Object { | |
|
||
exports[`triangle should properly render topRight pointing arrow with blue foregroundColor, width of 20px and height 20px 1`] = ` | ||
Object { | ||
"borderColor": "transparent blue transparent transparent", | ||
"borderColor": "transparent", | ||
"borderRightColor": "blue", | ||
"borderStyle": "solid", | ||
"borderWidth": "0 20px 20px 0", | ||
"height": "0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Unfortunately, key order matters a lot for this particular use case.
borderColor
will overrideborderBottomColor
and make the element transparent. We had to do some magic in the original implementation to account for this: https://github.com/styled-components/polished/blob/8607d641e27d945612e81a3078b1674200d6286e/src/mixins/triangle.jsThere 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.
Is the object always sorted by key or is it just an artifact of the testing framework?
Did you mean using the border color helper or adding
!important
to borderBottomColor?