Skip to content

Commit

Permalink
IBX-414: Added ghost version of dropdown (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
dew326 authored Mar 29, 2022
1 parent b55bf18 commit c5ccb77
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bundle/Resources/public/js/scripts/core/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
const { width } = this.selectedItemsContainer.getBoundingClientRect();

this.itemsContainer.style['max-height'] = `${this.getItemsContainerHeight()}px`;
this.itemsContainer.style.width = `${width}px`;
this.itemsContainer.style.minWidth = `${width}px`;

return this.itemsContainer;
}
Expand Down
31 changes: 30 additions & 1 deletion src/bundle/Resources/public/scss/_dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@

&--selected {
position: relative;
padding-right: calculateRem(36px);

.ibexa-dropdown__item-check {
display: block;
Expand Down Expand Up @@ -299,7 +300,7 @@
}
}

&:not(&--is-disabled) {
&:not(&--is-disabled):not(&--ghost) {
.ibexa-dropdown {
&__selection-info {
&:not(.is-invalid):hover {
Expand Down Expand Up @@ -369,6 +370,34 @@
}
}
}

&--ghost {
min-width: auto;

.ibexa-dropdown {
&__selection-info {
border: none;
padding: 0 calculateRem(16px);

&::before {
display: none;
}

&:after {
content: '';
position: absolute;
right: calculateRem(8px);
width: 0;
height: 0;
border-style: solid;
border-width: calculateRem(6px) calculateRem(3px) 0 calculateRem(3px);
border-color: $ibexa-color-dark transparent transparent transparent;
transform: translate(0, -50%);
background: none;
}
}
}
}
}

.form-inline {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
{{ custom_init|default(false) ? "ibexa-dropdown--custom-init" }}
{{ is_dynamic ? "ibexa-dropdown--dynamic" }}
{{ is_small|default(false) ? "ibexa-dropdown--small" }}
{{ is_ghost|default(false) ? "ibexa-dropdown--ghost" }}
{{ no_items and not is_dynamic or is_disabled ? "ibexa-dropdown--disabled" }}
{{ class|default('') }}
"
Expand Down

0 comments on commit c5ccb77

Please sign in to comment.