Open
Conversation
Author
|
Additional info: This change allows me to remove this "monkey patch" from a project I'm currently working on: input[type=file]::file-selector-button {
background-color: var(--primary);
border: var(--primary);
border-radius: var(--br);
color: var(--white);
padding: var(--sm-pad) var(--md-pad);
display: inline-block;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
border: 1px solid transparent;
font-size: 1rem;
line-height: 1.5;
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
input[type=file]:hover::file-selector-button {
background-color: var(--primary-600);
border-color: var(--primary-600);
color: var(--white);
}
input[type=file]:not(:disabled):active::file-selector-button {
background-color: var(--primary-600);
border-color: var(--primary-600);
color: var(--white);
}
input[type=file]:focus::file-selector-button {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.5);
}
input[type=file]:disabled::file-selector-button {
opacity: .65;
cursor: not-allowed;
background-color: var(--primary);
border-color: var(--primary);
color: var(--white);
} |
Author
|
Side note: I'd like to thank the author and maintainers of this project. It's really great and I've been using it for a bunch of my personal projects for years now. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #56
Purpose
Add styling to file inputs so that the "Choose File" button matches that of the other buttons in an app.
Result
Here are before and after pictures:
before

after

Notes
The border around the active button could use some improvement. Currently, it gets clipped by the outer input element.
I'm not sure whether this would merit a minor or patch version update. Let me know which is most appropriate and I'll make the update.