From 66dea38ce8872a21441183d3de5ef2caa19db8f1 Mon Sep 17 00:00:00 2001 From: Lukasz Ostafin Date: Wed, 4 Dec 2024 13:39:30 +0100 Subject: [PATCH] IBX-9274: Context menu does not show up in 'Location' folder --- .../scss/ui/modules/common/_spinner.scss | 22 ++++++++++++++----- .../src/modules/common/spinner/spinner.js | 10 ++++++++- .../LocationListDataVisitor.php | 6 ++--- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/bundle/Resources/public/scss/ui/modules/common/_spinner.scss b/src/bundle/Resources/public/scss/ui/modules/common/_spinner.scss index bc8a361a38..971202f04a 100644 --- a/src/bundle/Resources/public/scss/ui/modules/common/_spinner.scss +++ b/src/bundle/Resources/public/scss/ui/modules/common/_spinner.scss @@ -1,11 +1,21 @@ +@use 'sass:list'; + .c-spinner { - @include spinner(calculateRem(26px), calculateRem(3px), $ibexa-color-primary); + $color-variants: ( + '--primary': $ibexa-color-primary, + '--light': $ibexa-color-white, + ); - &--small { - @include spinner(calculateRem(16px), calculateRem(2px), $ibexa-color-primary); - } + $size-variants: ( + '--small': calculateRem(16px) calculateRem(2px), + '--large': calculateRem(86px) calculateRem(6px), + ); - &--large { - @include spinner(calculateRem(86px), calculateRem(6px), $ibexa-color-primary); + @each $size-modifier, $sizes in $size-variants { + @each $color-modifier, $color in $color-variants { + &#{$size-modifier}.c-spinner#{$color-modifier} { + @include spinner(list.nth($sizes, 1), list.nth($sizes, 2), $color); + } + } } } diff --git a/src/bundle/ui-dev/src/modules/common/spinner/spinner.js b/src/bundle/ui-dev/src/modules/common/spinner/spinner.js index 3b5d66b8f0..928d0fc8da 100644 --- a/src/bundle/ui-dev/src/modules/common/spinner/spinner.js +++ b/src/bundle/ui-dev/src/modules/common/spinner/spinner.js @@ -9,10 +9,16 @@ export const SIZES = { LARGE: 'large', }; -const Spinner = ({ size }) => { +export const COLOR_VARIATNS = { + PRIMARY: 'primary', + LIGHT: 'light', +}; + +const Spinner = ({ size, colorVariant }) => { const className = createCssClassNames({ 'c-spinner': true, [`c-spinner--${size}`]: true, + [`c-spinner--${colorVariant}`]: true, }); return
; @@ -20,10 +26,12 @@ const Spinner = ({ size }) => { Spinner.propTypes = { size: PropTypes.oneOf(Object.values(SIZES)), + colorVariant: PropTypes.oneOf(Object.values(COLOR_VARIATNS)), }; Spinner.defaultProps = { size: SIZES.MEDIUM, + colorVariant: COLOR_VARIATNS.PRIMARY, }; export default Spinner; diff --git a/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationListDataVisitor.php b/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationListDataVisitor.php index 50b9704765..9c096b44e9 100644 --- a/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationListDataVisitor.php +++ b/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationListDataVisitor.php @@ -19,20 +19,18 @@ final class LocationListDataVisitor extends AbstractLocationDataVisitor public function visit(Visitor $visitor, Generator $generator, $data): void { $generator->startObjectElement('LocationList'); + $generator->startList('locations'); foreach ($data->getLocationList() as $locationList) { - $generator->startList('locations'); - $generator->startHashElement('locationWithPermissions'); $this->buildLocationNode($locationList['location'], $generator, $visitor); $this->buildPermissionNode($locationList['permissions'], $generator); $generator->endHashElement('locationWithPermissions'); - - $generator->endList('locations'); } + $generator->endList('locations'); $generator->endObjectElement('LocationList'); } }