Skip to content

Commit c2011bd

Browse files
committed
* Moved some config options to private constants
* Removed unneeded props in keyframes
1 parent c2bfd60 commit c2011bd

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/index.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,39 @@ const plugin = require("tailwindcss/plugin");
33
module.exports = plugin.withOptions(
44
({
55
animationDuration = "0.6s",
6-
animationName = "wobble",
7-
boxShadowInsetStart = "4px",
8-
boxShadowInsetEnd = "6px",
96
enableAnimation = true,
107
highlightColor = "#f16bc9",
11-
outlineWidthStart = "4px",
12-
outlineWidthEnd = "6px",
13-
outlineStyle = "solid",
8+
widthStart = "8px",
9+
widthEnd = "12px",
1410
} = {}) => {
1511
return function ({ addUtilities, e }) {
12+
const BOX_SHADOW_INSET_START = "4px";
13+
const BOX_SHADOW_INSET_END = "6px";
14+
const ANIMATION_NAME = "wobble";
15+
const OUTLINE_STYLE = "solid";
16+
1617
const animation = enableAnimation
1718
? `${e(
1819
"?"
19-
)}${animationName} ${animationDuration} ease-in-out alternate infinite`
20+
)}${ANIMATION_NAME} ${animationDuration} ease-in-out alternate infinite`
2021
: "none";
2122

2223
addUtilities({
2324
[`.${e("?")}`]: {
24-
"outline-style": outlineStyle,
25-
"outline-width": outlineWidthStart,
25+
"outline-style": OUTLINE_STYLE,
26+
"outline-width": widthStart,
2627
"outline-color": highlightColor,
27-
"box-shadow": `inset ${boxShadowInsetStart} ${boxShadowInsetStart} ${highlightColor}, inset -${boxShadowInsetStart} -${boxShadowInsetStart} ${highlightColor}`,
28+
"box-shadow": `inset ${BOX_SHADOW_INSET_START} ${BOX_SHADOW_INSET_START} ${highlightColor}, inset -${BOX_SHADOW_INSET_START} -${BOX_SHADOW_INSET_START} ${highlightColor}`,
2829
animation: animation,
2930
},
30-
[`@keyframes ${e("?")}${animationName}`]: {
31+
[`@keyframes ${e("?")}${ANIMATION_NAME}`]: {
3132
"0%": {
32-
"outline-width": outlineWidthStart,
33-
"outline-color": highlightColor,
34-
"box-shadow": `inset ${boxShadowInsetStart} ${boxShadowInsetStart} ${highlightColor}, inset -${boxShadowInsetStart} -${boxShadowInsetStart} ${highlightColor}`,
33+
"outline-width": widthStart,
34+
"box-shadow": `inset ${BOX_SHADOW_INSET_START} ${BOX_SHADOW_INSET_START} ${highlightColor}, inset -${BOX_SHADOW_INSET_START} -${BOX_SHADOW_INSET_START} ${highlightColor}`,
3535
},
3636
"100%": {
37-
"outline-width": outlineWidthEnd,
38-
"outline-color": highlightColor,
39-
"box-shadow": `inset ${boxShadowInsetEnd} ${boxShadowInsetEnd} ${highlightColor}, inset -${boxShadowInsetEnd} -${boxShadowInsetEnd} ${highlightColor}`,
37+
"outline-width": widthEnd,
38+
"box-shadow": `inset ${BOX_SHADOW_INSET_END} ${BOX_SHADOW_INSET_END} ${highlightColor}, inset -${BOX_SHADOW_INSET_END} -${BOX_SHADOW_INSET_END} ${highlightColor}`,
4039
},
4140
},
4241
});

0 commit comments

Comments
 (0)