From dc02201a2d904ab045d0bda824961538e06c5116 Mon Sep 17 00:00:00 2001 From: Nestor Vera Date: Fri, 22 Feb 2019 16:47:58 +0100 Subject: [PATCH 1/2] Allow users to configure cursors --- defaultTheme.js | 8 ++++++++ src/plugins/cursor.js | 27 +++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/defaultTheme.js b/defaultTheme.js index d13bce6f9..420e23dac 100644 --- a/defaultTheme.js +++ b/defaultTheme.js @@ -210,6 +210,14 @@ module.exports = function() { lg: '.5rem', full: '9999px', }, + cursor: { + 'auto': 'auto', + 'default': 'default', + 'pointer': 'pointer', + 'wait': 'wait', + 'move': 'move', + 'not-allowed': 'not-allowed', + }, width: theme => ({ auto: 'auto', ...theme.spacing, diff --git a/src/plugins/cursor.js b/src/plugins/cursor.js index 1de7683b8..2753656a3 100644 --- a/src/plugins/cursor.js +++ b/src/plugins/cursor.js @@ -1,15 +1,18 @@ -export default function({ variants }) { - return function({ addUtilities }) { - addUtilities( - { - '.cursor-auto': { cursor: 'auto' }, - '.cursor-default': { cursor: 'default' }, - '.cursor-pointer': { cursor: 'pointer' }, - '.cursor-wait': { cursor: 'wait' }, - '.cursor-move': { cursor: 'move' }, - '.cursor-not-allowed': { cursor: 'not-allowed' }, - }, - variants +import _ from 'lodash' + +export default function({ values, variants }) { + return function({ addUtilities, e }) { + const utilities = _.fromPairs( + _.map(values, (value, modifier) => { + return [ + `.${e(`cursor-${modifier}`)}`, + { + 'cursor': value, + }, + ] + }) ) + + addUtilities(utilities, variants) } } From 0db948f3e8ac65bc71a750b51e511287cf95624e Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Fri, 22 Feb 2019 12:47:23 -0500 Subject: [PATCH 2/2] Fix style --- defaultTheme.js | 10 +++++----- src/plugins/cursor.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/defaultTheme.js b/defaultTheme.js index 420e23dac..72c30190c 100644 --- a/defaultTheme.js +++ b/defaultTheme.js @@ -211,11 +211,11 @@ module.exports = function() { full: '9999px', }, cursor: { - 'auto': 'auto', - 'default': 'default', - 'pointer': 'pointer', - 'wait': 'wait', - 'move': 'move', + auto: 'auto', + default: 'default', + pointer: 'pointer', + wait: 'wait', + move: 'move', 'not-allowed': 'not-allowed', }, width: theme => ({ diff --git a/src/plugins/cursor.js b/src/plugins/cursor.js index 2753656a3..a81f34ef0 100644 --- a/src/plugins/cursor.js +++ b/src/plugins/cursor.js @@ -7,7 +7,7 @@ export default function({ values, variants }) { return [ `.${e(`cursor-${modifier}`)}`, { - 'cursor': value, + cursor: value, }, ] })