Skip to content
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

Add placeholder mixin #42

Merged
merged 9 commits into from
Dec 16, 2016
Merged

Add placeholder mixin #42

merged 9 commits into from
Dec 16, 2016

Conversation

bhough
Copy link
Contributor

@bhough bhough commented Dec 10, 2016

Add placeholder mixin

Add placeholder mixin for target or placeholder styling in all browsers.

n/a
Docs for placeholder mixin
Add placeholder mixin for target or placeholder styling in all browsers.

n/a
@codecov-io
Copy link

codecov-io commented Dec 10, 2016

Current coverage is 100% (diff: 100%)

Merging #42 into master will not change coverage

@@           master   #42   diff @@
===================================
  Files          11    12     +1   
  Lines          30    31     +1   
  Methods         0     0          
  Messages        0     0          
  Branches        0     0          
===================================
+ Hits           30    31     +1   
  Misses          0     0          
  Partials        0     0          

Powered by Codecov. Last update 69f1bbb...8a5bdaf

Fix merge conflicts
@mxstbr mxstbr mentioned this pull request Dec 10, 2016
50 tasks
Copy link
Member

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

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

I'm not sure if we should add this – shouldn't the autoprefixers of the various libraries take care of that?

*
* // styled-components usage
* const div = styled.input`
* ...placeholder(styles)
Copy link
Member

Choose a reason for hiding this comment

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

No ..., this should be ${placeholder(cssbackground: red)}

Since css returns an Array, you'll also need to amend the types to allow for that!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would placeholder need its types amended though? It's css that is modifying placeholder's output to an array. If another JS to CSS library implemented another means that changed the type we would need to add that too.

Copy link
Member

Choose a reason for hiding this comment

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

No, the input is then an array, the output is still an object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

duh...coding past midnight is never a good idea. I'll fix this in the morning.

Copy link
Member

Choose a reason for hiding this comment

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

Any update here?

Copy link
Contributor Author

@bhough bhough Dec 14, 2016

Choose a reason for hiding this comment

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

@mxstbr just got back on this. I want to make sure I understand this situation, because it is more than just amending the types from what I can see. Here is what I'm seeing:

const styles = {
  "background": "blue",
  "color": "red"
};

return css`${styles}`

This returns

[
"background: blue; color: red;"
]

That means we would be passing placeholder an array with a single item that contains all the styles passed into it. Is that correct?

If that is the case I will need to refactor this, as spreading the passed in styles would not accommodate this use case, especially since the goal is to return an css as js object.

Copy link
Member

Choose a reason for hiding this comment

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

That should totally work for styled components:

const Box = styled.div`
  ${placeholder(css`styles`)}
`

We support arrays too, so this should work perfectly fine if just passed through, but please try it out!

@bhough
Copy link
Contributor Author

bhough commented Dec 10, 2016

I'm not sure if we should add this – shouldn't the autoprefixers of the various libraries take care of that?

When we originally made the list I had thrown together a bunch of prefixers for testing and came across a few that did not catch this or ::selection. I can go back through them and see if that is still the case. Could be useful to leave this and #41 in and deprecate later if we think that changes. Open to discussion on this though.

@mxstbr
Copy link
Member

mxstbr commented Dec 10, 2016

Okay, that sounds reasonable! Thanks for checking that!

Add placeholder mixin for target or placeholder styling in all browsers.

n/a
Docs for placeholder mixin
Add placeholder mixin for target or placeholder styling in all browsers.

n/a
@bhough
Copy link
Contributor Author

bhough commented Dec 15, 2016

@mxstbr this is ready...again 😉

Copy link
Member

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

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

Awesome!

@mxstbr mxstbr merged commit fb9d06b into master Dec 16, 2016
@mxstbr mxstbr deleted the placeholders branch December 16, 2016 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants