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 peer variants #480

Merged
merged 2 commits into from
Aug 21, 2021
Merged

Add peer variants #480

merged 2 commits into from
Aug 21, 2021

Conversation

ben-rogerson
Copy link
Owner

@ben-rogerson ben-rogerson commented Jul 17, 2021

This PR adds the peer-x variants which can be used like this:

// When the `.peer` element is hovered/focussed, the div recieves `display: block`
<div>
	<button className="peer">Test</button>
	<div tw="peer-hover:peer-focus:block" />
</div>

Here's the conversion that takes place:

import tw from "twin.macro";

tw`peer-hover:peer-focus:block`;

// ↓ ↓ ↓ ↓ ↓ ↓

({
  ".peer:hover:focus ~ &": {
    "display": "block"
  }
});

@ben-rogerson ben-rogerson mentioned this pull request Jul 17, 2021
13 tasks
@ben-rogerson ben-rogerson merged commit 92cbfb0 into master Aug 21, 2021
@ben-rogerson ben-rogerson deleted the feature/peer-variants branch August 21, 2021 00:43
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.

1 participant