Skip to content

Commit

Permalink
IBX-9069: Initial Product Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
tischsoic committed Nov 22, 2024
1 parent 44441cf commit f14fb1d
Show file tree
Hide file tree
Showing 23 changed files with 793 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
@import 'universal-discovery/finder.branch';
@import 'universal-discovery/finder.leaf';
@import 'universal-discovery/content.meta.preview';
@import 'universal-discovery/selected.items.panel.item';
@import 'universal-discovery/selected.items.panel';
@import 'universal-discovery/selected.locations';
@import 'universal-discovery/selected.locations.item';
@import 'universal-discovery/grid';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
height: 100%;
}

&__sidebar {
display: flex;
&__content-meta-preview:not(:empty) {
flex: 1;
height: 100%;
min-width: calculateRem(270px);
margin-right: calculateRem(24px);
border-right: calculateRem(1px) solid $ibexa-color-light;
background-color: $ibexa-color-white;
overflow: auto;
border-left: calculateRem(1px) solid $ibexa-color-light;
}

&__filters {
border-left: calculateRem(1px) solid $ibexa-color-light;
}

&__spinner-wrapper {
Expand All @@ -41,12 +43,13 @@
}

&__content {
flex: 2;
display: flex;
flex-direction: column;
overflow: auto;
width: 100%;
flex-shrink: 1;
padding: 0 calculateRem(8px);
padding: calculateRem(24px);
background-color: $ibexa-color-white;
position: relative;
}
Expand All @@ -73,7 +76,6 @@
display: grid;
grid-template: 'title clear-search-btn' 'subtitle subtitle';
justify-content: start;
margin-top: calculateRem(16px);
}

&__table-tile {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.c-selected-items-panel-item {
display: flex;
align-items: center;
padding: calculateRem(5px);
margin-bottom: calculateRem(8px);
border: calculateRem(1px) solid $ibexa-color-light;
border-radius: $ibexa-border-radius;
box-shadow: calculateRem(4px) calculateRem(2px) calculateRem(17px) 0 rgba($ibexa-color-black, 0.05);

&__image-wrapper {
width: calculateRem(42px);
height: calculateRem(42px);
background-color: $ibexa-color-light-300;
border-radius: $ibexa-border-radius-small;
display: flex;
justify-content: center;
align-items: center;
}

&__info {
display: flex;
flex-direction: column;
justify-content: center;
flex: 1;
width: calculateRem(185px);
padding: 0 calculateRem(15px);
}

&__info-name {
font-size: $ibexa-text-font-size;
}

&__info-description {
font-size: $ibexa-text-font-size-small;
color: $ibexa-color-dark-400;
}

&__actions-wrapper {
display: flex;
justify-content: flex-end;
align-items: center;
}

&__remove-button {
width: calculateRem(32px);
height: calculateRem(32px);
padding: 0;
display: inline-flex;
justify-content: center;
align-items: center;

.ibexa-icon {
fill: $ibexa-color-dark;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.c-selected-items-panel {
background-color: $ibexa-color-white;
position: fixed;
top: calc(100vh - calculateRem(98px));
bottom: calculateRem(31px);
left: calculateRem(16px);
min-height: calculateRem(60px);
border: calculateRem(1px) solid $ibexa-color-light;
border-top-right-radius: $ibexa-border-radius;
border-bottom-right-radius: $ibexa-border-radius;
box-shadow: calculateRem(4px) calculateRem(22px) calculateRem(47px) 0 rgba($ibexa-color-info, 0.15);
z-index: 1;
transition: all $ibexa-admin-transition-duration $ibexa-admin-transition;

&__header {
display: flex;
justify-content: start;
align-items: center;
padding: calculateRem(16px);
}

&__selection-counter {
color: $ibexa-color-dark;
font-size: calculateRem(22px);
font-weight: 600;
padding-right: calculateRem(16px);
}

&--expanded {
bottom: calculateRem(16px);
top: calculateRem(88px);
min-width: calculateRem(491px);
overflow: hidden;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: $ibexa-border-radius;

.c-selected-items-panel {
&__items-wrapper {
display: block;
}

&__toggle-button-icon {
transform: rotate(0);
}
}
}

&__items-wrapper {
display: none;
overflow: auto;
padding: 0 calculateRem(38px) calculateRem(16px) calculateRem(22px);
border-top: calculateRem(1px) solid $ibexa-color-light;
height: calc(100% - calculateRem(70px));
}

&__actions {
padding: calculateRem(16px) 0;
display: flex;
justify-content: flex-end;
}

&__toggle-button {
display: flex;
width: calculateRem(32px);
height: calculateRem(32px);
justify-content: center;
align-items: center;
margin-right: calculateRem(32px);
}

&__toggle-button-icon {
transform: rotate(180deg);
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
.c-selected-locations {
background-color: $ibexa-color-white;
position: fixed;
top: calculateRem(95px);
right: calculateRem(16px);
top: calc(100vh - calculateRem(98px));
bottom: calculateRem(31px);
left: calculateRem(16px);
min-height: calculateRem(60px);
min-width: calculateRem(390px);
border: calculateRem(1px) solid $ibexa-color-light;
border-top-left-radius: $ibexa-border-radius;
border-bottom-left-radius: $ibexa-border-radius;
border-top-right-radius: $ibexa-border-radius;
border-bottom-right-radius: $ibexa-border-radius;
box-shadow: calculateRem(4px) calculateRem(22px) calculateRem(47px) 0 rgba($ibexa-color-info, 0.15);
z-index: 1;
transition: all $ibexa-admin-transition-duration $ibexa-admin-transition;

&__header {
display: flex;
justify-content: space-between;
justify-content: start;
align-items: center;
padding: calculateRem(7px) calculateRem(12px) calculateRem(7px) calculateRem(22px);
padding: calculateRem(16px);
}

&__selection-counter {
Expand All @@ -27,14 +27,22 @@
}

&--expanded {
bottom: calculateRem(100px);
bottom: calculateRem(16px);
top: calculateRem(88px);
min-width: calculateRem(491px);
overflow: hidden;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: $ibexa-border-radius;

.c-selected-locations {
&__items-wrapper {
display: block;
}

&__toggle-button-icon {
transform: rotate(0);
}
}
}

Expand All @@ -51,4 +59,17 @@
display: flex;
justify-content: flex-end;
}

&__toggle-button {
display: flex;
width: calculateRem(32px);
height: calculateRem(32px);
justify-content: center;
align-items: center;
margin-right: calculateRem(32px);
}

&__toggle-button-icon {
transform: rotate(180deg);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import React, { useContext, useState, useEffect, useCallback, useRef } from 'rea
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';

import FiltersPanel from './filters.panel';
import FiltersRow from './filters.row';

import {
SelectedContentTypesContext,
SelectedSectionContext,
Expand Down Expand Up @@ -69,7 +72,7 @@ const Filters = ({ search }) => {
const makeSearch = useCallback(() => {
prevSelectedLanguage.current = selectedLanguage;

search(0);
search();
}, [search, selectedLanguage]);
const isApplyButtonEnabled =
!!selectedContentTypes.length || !!selectedSection || !!selectedSubtree || prevSelectedLanguage.current !== selectedLanguage;
Expand Down Expand Up @@ -115,12 +118,9 @@ const Filters = ({ search }) => {
</button>
);
};
const filtersLabel = Translator.trans(/*@Desc("Filters")*/ 'filters.title', {}, 'ibexa_universal_discovery_widget');
const languageLabel = Translator.trans(/*@Desc("Language")*/ 'filters.language', {}, 'ibexa_universal_discovery_widget');
const sectionLabel = Translator.trans(/*@Desc("Section")*/ 'filters.section', {}, 'ibexa_universal_discovery_widget');
const subtreeLabel = Translator.trans(/*@Desc("Subtree")*/ 'filters.subtree', {}, 'ibexa_universal_discovery_widget');
const clearLabel = Translator.trans(/*@Desc("Clear")*/ 'filters.clear', {}, 'ibexa_universal_discovery_widget');
const applyLabel = Translator.trans(/*@Desc("Apply")*/ 'filters.apply', {}, 'ibexa_universal_discovery_widget');
const languageOptions = Object.values(adminUiConfig.languages.mappings)
.filter((language) => language.enabled)
.map((language) => ({
Expand Down Expand Up @@ -150,25 +150,8 @@ const Filters = ({ search }) => {
return (
<>
{isNestedUdwOpened && ReactDOM.createPortal(<UniversalDiscoveryModule {...nestedUdwConfig} />, nestedUdwContainer.current)}
<div className="c-filters">
<div className="c-filters__header">
<div className="c-filters__header-content">{filtersLabel}</div>
<div className="c-filters__header-actions">
<button className="btn ibexa-btn ibexa-btn--ghost ibexa-btn--small" type="button" onClick={clearFilters}>
{clearLabel}
</button>
<button
type="submit"
className="btn ibexa-btn ibexa-btn--secondary ibexa-btn--small ibexa-btn--apply"
onClick={makeSearch}
disabled={!isApplyButtonEnabled}
>
{applyLabel}
</button>
</div>
</div>
<div className="c-filters__row c-filters__row--language">
<div className="c-filters__row-title">{languageLabel}</div>
<FiltersPanel isApplyButtonEnabled={isApplyButtonEnabled} makeSearch={makeSearch} clearFilters={clearFilters}>
<FiltersRow title={languageLabel} extraClasses="c-filters__row--language">
<Dropdown
dropdownListRef={dropdownListRef}
single={true}
Expand All @@ -177,10 +160,9 @@ const Filters = ({ search }) => {
options={languageOptions}
extraClasses="c-udw-dropdown"
/>
</div>
</FiltersRow>
<ContentTypeSelector />
<div className="c-filters__row">
<div className="c-filters__row-title">{sectionLabel}</div>
<FiltersRow title={sectionLabel}>
<Dropdown
dropdownListRef={dropdownListRef}
single={true}
Expand All @@ -189,15 +171,14 @@ const Filters = ({ search }) => {
options={sectionOptions}
extraClasses="c-udw-dropdown"
/>
</div>
<div className="c-filters__row">
<div className="c-filters__row-title">{subtreeLabel}</div>
</FiltersRow>
<FiltersRow title={subtreeLabel}>
<div className="ibexa-tag-view-select">
{renderSubtreeBreadcrumbs()}
{renderSelectContentButton()}
</div>
</div>
</div>
</FiltersRow>
</FiltersPanel>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react';
import PropTypes from 'prop-types';

import { getTranslator } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';

const FiltersPanel = ({ children, isApplyButtonEnabled, makeSearch, clearFilters }) => {
const Translator = getTranslator();
const filtersLabel = Translator.trans(/*@Desc("Filters")*/ 'filters.title', {}, 'ibexa_universal_discovery_widget');
const clearLabel = Translator.trans(/*@Desc("Clear")*/ 'filters.clear', {}, 'ibexa_universal_discovery_widget');
const applyLabel = Translator.trans(/*@Desc("Apply")*/ 'filters.apply', {}, 'ibexa_universal_discovery_widget');

return (
<div className="c-filters">
<div className="c-filters__header">
<div className="c-filters__header-content">{filtersLabel}</div>
<div className="c-filters__header-actions">
<button className="btn ibexa-btn ibexa-btn--ghost ibexa-btn--small" type="button" onClick={clearFilters}>
{clearLabel}
</button>
<button
type="button"
className="btn ibexa-btn ibexa-btn--secondary ibexa-btn--small ibexa-btn--apply"
onClick={makeSearch}
disabled={!isApplyButtonEnabled}
>
{applyLabel}
</button>
</div>
</div>
{children}
</div>
);
};

FiltersPanel.propTypes = {
children: PropTypes.node.isRequired,
isApplyButtonEnabled: PropTypes.bool.isRequired,
makeSearch: PropTypes.func.isRequired,
clearFilters: PropTypes.func.isRequired,
};

export default FiltersPanel;
Loading

0 comments on commit f14fb1d

Please sign in to comment.