Last active
January 14, 2018 22:13
-
-
Save alexreardon/77933916fdce05ed3406b631425c8e08 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Create a new style element | |
| const el = document.createElement('style'); | |
| el.type = 'text/css'; | |
| // Add it to the head of the document | |
| const head = document.querySelector('head'); | |
| head.appendChild(el); | |
| // At some future point we can totally redefine the entire content of the style element | |
| const setStyle = (newStyles) => { | |
| el.innerHTML = newStyles; | |
| }; | |
| // We can apply some styles at one point in the lifecyle | |
| setStyle(` | |
| [data-react-beautiful-dnd-drag-handle] { | |
| cursor: grab; | |
| } | |
| `); | |
| // At another point we can change these styles | |
| setStyle(` | |
| body { | |
| cursor: grabbing; | |
| } | |
| [data-react-beautiful-dnd-drag-handle] { | |
| point-events: none; | |
| } | |
| [data-react-beautiful-dnd-draggable] { | |
| transition: transform 0.2s ease; | |
| } | |
| `); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment