-
Notifications
You must be signed in to change notification settings - Fork 6
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
[Feature] Add customization options #10
[Feature] Add customization options #10
Conversation
Thanks for the PR @mrcelo. I wonder if we need all of these to be configurable? If we avoid exposing anything about box shadow or outline, we give ourselves the option of changing how this plugin works internally in future. Perhaps these are the important ones?
What do you think? |
* Removed unneeded props in keyframes
Those are all great suggestions, thanks for pointing that out. I've gone ahead and implemented these changes (and put a few constants in). For my use case, Let me know if LGTY. Thanks! |
src/index.js
Outdated
} = {}) => { | ||
return function ({ addUtilities, e }) { | ||
const BOX_SHADOW_INSET_START = "4px"; | ||
const BOX_SHADOW_INSET_END = "6px"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that the inset and outline are symmetrical, perhaps we should use widthStart and widthEnd for both?
If widthStart is 8px, we could apply 4px to both the inset and the outline. We'd need to do a little parsing of the string, but it might make for a nice api
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this?
function parsePx(input, defaultValue) {
let value = input.match(/^\d+px$/);
if (value) {
return parseInt(value[0], 10);
}
return defaultValue;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely, that's a great idea. Small nitpick, but perhaps the regex /\d+px/
would better approximate browser behavior when parsing the CSS value (i.e. ignoring whitespaces or chars before or after the px
substring). Would it be worth it to sanitize this far? How does that sound?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, thanks
* Added parsePx func * Fixed typos * Organized code
This is really great, thanks! |
This PR adds customization options with original defaults (#1):
animationDuration
animationName
boxShadowInsetStart
boxShadowInsetEnd
highlightColor
outlineWidthStart
outlineWidthEnd
outlineStyle
enableAnimation