Skip to content
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 38 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
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 Sep 1, 2024
8dc948d
feat(file-upload): more changes
kentokage Sep 1, 2024
47b946d
feat(file-upload): fixes
kentokage Sep 3, 2024
5aca7ed
feat(file-upload): add RTL stories
kentokage Sep 3, 2024
0c6a41c
feat(file-upload): add build
kentokage Sep 3, 2024
6ea051d
feat(file-upload): add changeset
kentokage Sep 3, 2024
cea0d1f
feat(file-upload): feedback 1
kentokage Sep 4, 2024
b1d620a
feat(file-upload): feedback 2
kentokage Sep 4, 2024
5182a53
feat(file-upload): refactor to use media query
kentokage Sep 4, 2024
3b378a3
feat(file-upload): remove unnecessary css
kentokage Sep 4, 2024
634eab4
feat(file-upload-input): refactor components
kentokage Sep 5, 2024
fe1b3fb
feat(file-upload): refactor file-preview-card
kentokage Sep 5, 2024
63bf028
feat(file-upload): address comments
kentokage Sep 6, 2024
7683ad6
feat(file-upload): add card group
kentokage Sep 8, 2024
ebfdf46
feat(file-upload): update story
kentokage Sep 8, 2024
837c521
feat(file-upload): refactor card
kentokage Sep 9, 2024
796892d
feat(file-upload): refactor cleaner
kentokage Sep 9, 2024
978bc97
feat(file-upload): add card and group modules
kentokage Sep 9, 2024
4d7f5a9
feat(file-upload): build changes
kentokage Sep 9, 2024
816c709
feat(file-upload): small fixes
kentokage Sep 9, 2024
d148ddd
feat(file-upload): address feedback
kentokage Sep 9, 2024
c417842
feat(file-upload): a11y feedback
kentokage Sep 10, 2024
e167c1b
feat(file-upload): fix input
kentokage Sep 11, 2024
d1baeee
feat(file-upload): feedback
kentokage Sep 11, 2024
64e8d8b
Merge remote-tracking branch 'eBay/18.3.0' into 2428-file-upload-new-…
kentokage Sep 11, 2024
5178cf0
feat(file-upload): fix lint
kentokage Sep 11, 2024
2543d04
feat(file-upload): add mixin
kentokage Sep 12, 2024
99fcbb0
feat(file-upload): fix css
kentokage Sep 13, 2024
a5b309c
feat(file-upload): address feedback
kentokage Sep 16, 2024
805fb41
feat(file-upload): fix label and add drag style
kentokage Sep 17, 2024
f6d2b3a
feat(file-upload): fix css
kentokage Sep 18, 2024
fae168c
feat(file-upload): fix skin app dashed border
kentokage Sep 18, 2024
5823a86
feat(file-upload): remove upload failed state and fix style
kentokage Sep 19, 2024
6a86f99
feat(file-upload): address feedback
kentokage Sep 20, 2024
d093470
feat(file-upload): address feedback and fixes
kentokage Sep 20, 2024
26ec8b3
feat(file-upload): address feedback
kentokage Sep 25, 2024
e03eabf
feat(file-input): rename
kentokage Sep 27, 2024
9add60c
feat(file-input): address comments
kentokage Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lemon-dancers-serve.md
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 dist/file-preview-card-group/file-preview-card-group.css
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);
}
}
149 changes: 149 additions & 0 deletions dist/file-preview-card/file-preview-card.css
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
);
}
125 changes: 125 additions & 0 deletions dist/file-upload-input/file-upload-input.css
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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

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;
}
}
Loading