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 new ring classes #204

Merged
merged 1 commit into from
Nov 25, 2020
Merged

Add new ring classes #204

merged 1 commit into from
Nov 25, 2020

Conversation

ben-rogerson
Copy link
Owner

@ben-rogerson ben-rogerson commented Nov 22, 2020

This PR adds the entire set of new ring classes:

How it works

To make these ring classes work, a bunch of css variables are added to every element using the <GlobalStyles /> import:

* {
  --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/);
  --tw-ring-offset-width: 0px;
  --tw-ring-offset-color: #fff;
  --tw-ring-color: rgba(59, 130, 246, 0.5);
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
}

Then when you use one of the new classes like ring, it will use the default css variables until you specify an overriding class:

tw`ring ring-offset-4`

// ↓ ↓ ↓ ↓ ↓ ↓

{
  "--tw-ring-offset-shadow": "var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)",
  "--tw-ring-shadow": "var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)",
  "boxShadow": "var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)",
  "--tw-ring-offset-width": "4px"
}

@ben-rogerson ben-rogerson mentioned this pull request Nov 22, 2020
14 tasks
@ben-rogerson ben-rogerson merged commit 8a4a652 into master Nov 25, 2020
@ben-rogerson ben-rogerson deleted the feature/ring-classes branch November 25, 2020 20:35
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