Skip to content

Commit

Permalink
fix(file-picker): add background color to uploaded items in list (VIV…
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelbt authored Jul 22, 2024
1 parent 7dc2e22 commit 9c1a929
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
7 changes: 7 additions & 0 deletions libs/components/src/lib/file-picker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ The `helper-text` slot allows you to use rich content as the file picker's helpe
</vwc-file-picker>
```

## CSS Variables

### file-picker-list-item-background-color

Each added file in the preview list has a default background-color of `vvd-color-canvas` (`#fff` in light theme, `#000` in dark).
If needed, the background of the item can be changed using the `--file-picker-list-item-background-color` CSS variable.

## Properties

<div class="table-wrapper">
Expand Down
15 changes: 10 additions & 5 deletions libs/components/src/lib/file-picker/file-picker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@use '../../../../shared/src/lib/sass/mixins/focus' as focus-variables;

$low-ink-color: --_low-ink-color;
$file-picker-list-item-background-color: --file-picker-list-item-background-color;

:host {
display: block;
Expand Down Expand Up @@ -55,8 +56,12 @@ $low-ink-color: --_low-ink-color;
.dz-preview {
display: grid;
box-sizing: border-box;
padding: 6px 12px;
padding: 8px;
border-radius: #{border-radius-variables.$border-radius-normal};
background-color: var(
#{$file-picker-list-item-background-color},
var(#{constants.$vvd-color-canvas})
);
grid-template-columns: 1fr auto;
grid-template-rows: auto auto;
inline-size: 100%;
Expand Down Expand Up @@ -116,13 +121,13 @@ $low-ink-color: --_low-ink-color;
}

.preview-list {
&:empty {
display: none;
}

display: flex;
flex-direction: column;
gap: 12px;
margin-block-start: 12px;
overflow-y: auto;

&:empty {
display: none;
}
}
3 changes: 2 additions & 1 deletion libs/components/src/lib/file-picker/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ const addFile = async (
};

test('should show the component', async ({ page }: { page: Page }) => {
const template = `<vwc-layout column-basis="block">
const template = `<div style="background-color: var(--vvd-color-neutral-50); padding: 8px;"><vwc-layout column-basis="block">
<vwc-file-picker label="Pick files" helper-text="multiple files of any type" max-file-size="0.001" accept="image/*">
Drag & Drop or click to upload
</vwc-file-picker>
</div>
<vwc-file-picker label="Pick files" helper-text="multiple files of any type" size="expanded">
Drag & Drop or click to upload
</vwc-file-picker>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9c1a929

Please sign in to comment.