-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat(file-input): new module #2435
Merged
Merged
Changes from 32 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
38e2ea2
feat(file-upload): new module
kentokage 8dc948d
feat(file-upload): more changes
kentokage 47b946d
feat(file-upload): fixes
kentokage 5aca7ed
feat(file-upload): add RTL stories
kentokage 0c6a41c
feat(file-upload): add build
kentokage 6ea051d
feat(file-upload): add changeset
kentokage cea0d1f
feat(file-upload): feedback 1
kentokage b1d620a
feat(file-upload): feedback 2
kentokage 5182a53
feat(file-upload): refactor to use media query
kentokage 3b378a3
feat(file-upload): remove unnecessary css
kentokage 634eab4
feat(file-upload-input): refactor components
kentokage fe1b3fb
feat(file-upload): refactor file-preview-card
kentokage 63bf028
feat(file-upload): address comments
kentokage 7683ad6
feat(file-upload): add card group
kentokage ebfdf46
feat(file-upload): update story
kentokage 837c521
feat(file-upload): refactor card
kentokage 796892d
feat(file-upload): refactor cleaner
kentokage 978bc97
feat(file-upload): add card and group modules
kentokage 4d7f5a9
feat(file-upload): build changes
kentokage 816c709
feat(file-upload): small fixes
kentokage d148ddd
feat(file-upload): address feedback
kentokage c417842
feat(file-upload): a11y feedback
kentokage e167c1b
feat(file-upload): fix input
kentokage d1baeee
feat(file-upload): feedback
kentokage 64e8d8b
Merge remote-tracking branch 'eBay/18.3.0' into 2428-file-upload-new-…
kentokage 5178cf0
feat(file-upload): fix lint
kentokage 2543d04
feat(file-upload): add mixin
kentokage 99fcbb0
feat(file-upload): fix css
kentokage a5b309c
feat(file-upload): address feedback
kentokage 805fb41
feat(file-upload): fix label and add drag style
kentokage f6d2b3a
feat(file-upload): fix css
kentokage fae168c
feat(file-upload): fix skin app dashed border
kentokage 5823a86
feat(file-upload): remove upload failed state and fix style
kentokage 6a86f99
feat(file-upload): address feedback
kentokage d093470
feat(file-upload): address feedback and fixes
kentokage 26ec8b3
feat(file-upload): address feedback
kentokage e03eabf
feat(file-input): rename
kentokage 9add60c
feat(file-input): address comments
kentokage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ebay/skin": minor | ||
--- | ||
|
||
feat(file-upload): new module |
115 changes: 115 additions & 0 deletions
115
dist/file-preview-card-group/file-preview-card-group.css
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
:root { | ||
--row-preview-cards-min: 2; | ||
--row-preview-cards-sm: 4; | ||
--row-preview-cards-md: 5; | ||
--row-preview-cards-lg: 7; | ||
--row-preview-cards-xl: 9; | ||
--row-preview-cards-xl2: 10; | ||
--row-preview-cards-xl3: 12; | ||
--row-preview-cards-xl4: 14; | ||
} | ||
|
||
div.file-preview-card-group { | ||
container: file-preview-cards-container/inline-size; | ||
} | ||
|
||
div.file-preview-card-group ul { | ||
display: grid; | ||
gap: var(--spacing-100, 8px); | ||
grid-template-columns: repeat(var(--row-preview-cards-min), 1fr); | ||
list-style: none; | ||
margin: 0; | ||
padding: 0; | ||
width: 100%; | ||
} | ||
|
||
div.file-preview-card-group ul li { | ||
height: max-content; | ||
} | ||
|
||
@supports not (contain: inline-size) { | ||
@media (min-width: 512px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-100, 8px); | ||
grid-template-columns: repeat(var(--row-preview-cards-sm), 1fr); | ||
} | ||
} | ||
@media (min-width: 768px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-md), 1fr); | ||
} | ||
} | ||
@media (min-width: 1024px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-lg), 1fr); | ||
} | ||
} | ||
@media (min-width: 1280px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-xl), 1fr); | ||
} | ||
} | ||
@media (min-width: 1440px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-xl2), 1fr); | ||
} | ||
} | ||
@media (min-width: 1680px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-xl3), 1fr); | ||
} | ||
} | ||
@media (min-width: 1920px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-xl4), 1fr); | ||
} | ||
} | ||
} | ||
@container file-preview-cards-container (inline-size >= 512px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-100, 8px); | ||
grid-template-columns: repeat(var(--row-preview-cards-sm), 1fr); | ||
} | ||
} | ||
@container file-preview-cards-container (inline-size >= 768px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-md), 1fr); | ||
} | ||
} | ||
@container file-preview-cards-container (inline-size >= 1024px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-lg), 1fr); | ||
} | ||
} | ||
@container file-preview-cards-container (inline-size >= 1280px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-xl), 1fr); | ||
} | ||
} | ||
@container file-preview-cards-container (inline-size >= 1440px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-xl2), 1fr); | ||
} | ||
} | ||
@container file-preview-cards-container (inline-size >= 1680px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-xl3), 1fr); | ||
} | ||
} | ||
@container file-preview-cards-container (inline-size >= 1920px) { | ||
div.file-preview-card-group ul { | ||
gap: var(--spacing-200, 16px); | ||
grid-template-columns: repeat(var(--row-preview-cards-xl4), 1fr); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
.file-preview-card { | ||
aspect-ratio: 1/1; | ||
background-color: var( | ||
--file-preview-card-background-color, | ||
var(--color-background-secondary) | ||
); | ||
border-radius: var( | ||
--file-preview-card-border-radius, | ||
var(--border-radius-100) | ||
); | ||
box-sizing: border-box; | ||
display: grid; | ||
grid-template-areas: " . . menu-action " " . center-action . " " label . . "; | ||
grid-template-columns: repeat(3, 1fr); | ||
grid-template-rows: repeat(3, 1fr); | ||
height: 100%; | ||
max-width: 396px; | ||
min-width: 120px; | ||
width: 100%; | ||
} | ||
|
||
.file-preview-card__center { | ||
align-items: center; | ||
display: flex; | ||
grid-area: 1/1/4/4; | ||
justify-content: center; | ||
} | ||
|
||
.file-preview-card__center img { | ||
border-radius: var( | ||
--file-preview-card-border-radius, | ||
var(--border-radius-100) | ||
); | ||
height: 100%; | ||
object-fit: contain; | ||
width: 100%; | ||
} | ||
|
||
.file-preview-card__center .inline-notice--attention { | ||
color: var( | ||
--file-preview-card-attention-color, | ||
var(--color-foreground-attention) | ||
); | ||
font-size: var(--font-size-12); | ||
line-height: var(--spacing-200, 16px); | ||
} | ||
|
||
.file-preview-card__center--overflow { | ||
opacity: 0.5; | ||
} | ||
|
||
.file-preview-card .file-preview-card__menu-action { | ||
grid-area: menu-action; | ||
justify-self: end; | ||
} | ||
|
||
.file-preview-card .file-preview-card__menu-action .icon-btn { | ||
background-color: var( | ||
--file-preview-card-menu-action-background-color, | ||
var(--color-background-primary) | ||
); | ||
height: 32px; | ||
margin: var(--spacing-100, 8px); | ||
width: 32px; | ||
} | ||
|
||
.file-preview-card__label { | ||
align-self: end; | ||
grid-area: label; | ||
} | ||
|
||
.file-preview-card__label .icon-btn { | ||
align-items: center; | ||
background-color: var( | ||
--file-preview-card-label-background-color, | ||
var(--color-background-primary) | ||
); | ||
display: flex; | ||
flex-direction: row; | ||
gap: var(--spacing-50, 4px); | ||
height: 20px; | ||
margin: var(--spacing-100, 8px); | ||
width: 55px; | ||
} | ||
|
||
.file-preview-card__label-text { | ||
color: var( | ||
--file-preview-card-label-text-color, | ||
var(--color-foreground-primary) | ||
); | ||
font-size: var(--font-size-12); | ||
font-weight: 400; | ||
} | ||
|
||
.file-preview-card .file-preview-card__center-action { | ||
align-self: center; | ||
grid-area: center-action; | ||
justify-self: center; | ||
z-index: 1; | ||
} | ||
|
||
.file-preview-card .file-preview-card__center-action .icon-btn { | ||
background-color: rgba( | ||
var( | ||
--file-preview-card-center-action-background-color-rgb, | ||
var(--color-background-strong-rgb) | ||
), | ||
0.5 | ||
); | ||
color: var( | ||
--file-preview-card-center-action-color, | ||
var(--color-foreground-on-strong) | ||
); | ||
font-size: var(--font-size-14); | ||
font-weight: 700; | ||
height: 40px; | ||
line-height: 20px; | ||
width: 40px; | ||
} | ||
|
||
.file-preview-card .file-preview-card__center-action .icon-btn:active, | ||
.file-preview-card .file-preview-card__center-action .icon-btn:focus, | ||
.file-preview-card .file-preview-card__center-action .icon-btn:hover { | ||
color: var( | ||
--file-preview-card-center-action-interactive-color, | ||
var(--color-foreground-primary) | ||
); | ||
} | ||
|
||
.file-preview-card .file-preview-card__center-action .icon-btn:focus, | ||
.file-preview-card .file-preview-card__center-action .icon-btn:hover { | ||
background-color: rgba( | ||
var( | ||
--file-preview-card-center-action-interactive-background-color-rgb, | ||
var(--color-state-secondary-hover-rgb) | ||
), | ||
0.5 | ||
); | ||
} | ||
|
||
.file-preview-card .file-preview-card__center-action .icon-btn:active { | ||
background-color: rgba( | ||
var( | ||
--file-preview-card-center-action-interactive-active-background-color-rgb, | ||
var(--color-state-secondary-active-rgb) | ||
), | ||
0.5 | ||
); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
div.file-upload-input { | ||
display: grid; | ||
grid-template-areas: "center"; | ||
grid-template-columns: 1fr; | ||
grid-template-rows: 1fr; | ||
} | ||
|
||
div.file-upload-input__container, | ||
input.file-upload-input__input[type="file"] { | ||
border-radius: var( | ||
--file-upload-input-border-radius, | ||
var(--border-radius-100) | ||
); | ||
grid-area: center; | ||
} | ||
|
||
div.file-upload-input__container { | ||
background-color: var( | ||
--file-upload-input-background-color, | ||
var(--color-background-secondary) | ||
); | ||
border: 1px dashed; | ||
display: flex; | ||
flex-direction: row; | ||
gap: var(--spacing-100, 8px); | ||
min-width: -moz-fit-content; | ||
min-width: fit-content; | ||
padding: var(--spacing-200, 16px); | ||
pointer-events: none; | ||
} | ||
|
||
div.file-upload-input___container--dragged-over { | ||
background-color: var( | ||
--file-upload-input-dragged-over-background-color, | ||
var(--color-background-tertiary) | ||
); | ||
} | ||
|
||
div.file-upload-input__upload-icon { | ||
align-self: center; | ||
background-color: var( | ||
--file-upload-input-upload-icon-background-color, | ||
var(--color-background-primary) | ||
); | ||
border-radius: 99px; | ||
max-height: 16px; | ||
padding: var(--spacing-200, 12px); | ||
} | ||
|
||
div.file-upload-input__upload-icon svg { | ||
fill: var( | ||
--file-upload-input-upload-icon-fill, | ||
var(--color-foreground-primary) | ||
); | ||
height: 16px; | ||
width: 16px; | ||
} | ||
|
||
svg.file-upload-input__upload-icon-large.icon { | ||
display: none; | ||
} | ||
|
||
div.file-upload-input__content { | ||
align-items: start; | ||
display: flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
justify-content: center; | ||
} | ||
|
||
span.file-upload-input__content-header { | ||
color: var( | ||
--file-upload-input-content-header-color, | ||
var(--color-foreground-primary) | ||
); | ||
font-size: var(--font-size-14); | ||
font-weight: 700; | ||
line-height: 20px; | ||
margin-bottom: 4px; | ||
} | ||
|
||
span.file-upload-input__content-subheader { | ||
color: var( | ||
--file-upload-input-content-subheader-color, | ||
var(--color-foreground-secondary) | ||
); | ||
font-size: var(--font-size-12); | ||
font-weight: 400; | ||
line-height: 16px; | ||
margin-bottom: var(--spacing-100, 8px); | ||
} | ||
|
||
span.file-upload-input__content-cta { | ||
-webkit-text-decoration-line: underline; | ||
text-decoration-line: underline; | ||
} | ||
|
||
@media screen and (min-width: 768px) { | ||
div.file-upload-input__container { | ||
gap: var(--spacing-300, 24px); | ||
padding: var(--spacing-300, 24px); | ||
} | ||
div.file-upload-input__upload-icon { | ||
max-height: 24px; | ||
padding: var(--spacing-300, 24px); | ||
} | ||
div.file-upload-input__upload-icon svg { | ||
height: 24px; | ||
width: 24px; | ||
} | ||
svg.file-upload-input__upload-icon-small.icon { | ||
display: none; | ||
} | ||
svg.file-upload-input__upload-icon-large.icon { | ||
display: inline-block; | ||
} | ||
span.file-upload-input__content-header { | ||
font-size: var(--font-size-16); | ||
line-height: 24px; | ||
} | ||
span.file-upload-input__content-subheader { | ||
font-size: var(--font-size-14); | ||
line-height: 20px; | ||
} | ||
} |
Oops, something went wrong.
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.
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.
This is a less than ideal responsive solution. Unless it's absolutely necessary (this case doesn't qualify), we should be using a single image. Hiding one image and showing another is brittle, creates unnecessary dependencies and makes the overall components larger than necessary.
You can use either icon and scale up as necessary. This would also allow us to do fluid sizing if needed so the icon is always relative to the viewport and does not snap. In this case, it would actually snap when the window is resized or a browser sidebar is opened or when the orientation is changed.
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.
Ok let me push back to design to just use one icon, since there is not much value with swapping.