Skip to content

Commit

Permalink
feat(file-picker): add styled scrollbar & fix files-list height (VIV-…
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelbt authored Dec 4, 2024
1 parent 85d28f5 commit ee96006
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
6 changes: 6 additions & 0 deletions libs/components/src/lib/file-picker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ The `helper-text` slot allows you to use rich content as the file picker's helpe
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.

## Dimensions

### Block-Size

When setting `block-size` or `max-block-size` on the file-picker the list of the added files will have auto scroll.

## Properties

<div class="table-wrapper">
Expand Down
26 changes: 17 additions & 9 deletions libs/components/src/lib/file-picker/file-picker.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
@use 'partials/variables' as variables;
@use '../../../../../dist/libs/tokens/scss/tokens.constants' as constants;
@use '../../../../../dist/libs/tokens/scss/size.variables' as size;
@use '../../../../shared/src/lib/sass/mixins/border-radius' as
border-radius-variables;
@use '../../../../shared/src/lib/sass/mixins/focus' as focus;
@use '../../../../shared/src/lib/sass/mixins/focus' as focus-variables;
@use '../../../../shared/src/lib/sass/mixins/scrollbar' as scrollbar;

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

:host {
display: block;
Expand All @@ -16,6 +17,8 @@ $file-picker-list-item-background-color: --file-picker-list-item-background-colo
.base {
display: flex;
flex-direction: column;
block-size: inherit;
max-block-size: inherit;
}

.control {
Expand Down Expand Up @@ -48,8 +51,9 @@ $file-picker-list-item-background-color: --file-picker-list-item-background-colo

@include focus.focus;
}
&:hover {
border-style: solid;
&:hover,
&:active,
&:focus-visible {
background-color: var(#{constants.$vvd-color-cta-100});
}
}
Expand All @@ -65,7 +69,7 @@ $file-picker-list-item-background-color: --file-picker-list-item-background-colo
border: 1px solid var(#{constants.$vvd-color-neutral-300});
border-radius: #{border-radius-variables.$border-radius-normal};
background-color: var(
#{$file-picker-list-item-background-color},
#{variables.$file-picker-list-item-background-color},
var(#{constants.$vvd-color-canvas})
);
grid-template-columns: 1fr auto;
Expand Down Expand Up @@ -127,11 +131,15 @@ $file-picker-list-item-background-color: --file-picker-list-item-background-colo
}

.preview-list {
display: flex;
flex-direction: column;
gap: 12px;
margin-block-start: 12px;
overflow-y: auto;
@include scrollbar.scrollbar;

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

&:empty {
display: none;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$file-picker-list-item-background-color: --file-picker-list-item-background-color;
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 ee96006

Please sign in to comment.