diff --git a/packages/cxl-ui/scss/cxl-filter-item.scss b/packages/cxl-ui/scss/cxl-filter-item.scss new file mode 100644 index 000000000..4b0deccba --- /dev/null +++ b/packages/cxl-ui/scss/cxl-filter-item.scss @@ -0,0 +1,24 @@ +:host { + display: flex; + justify-content: space-between; + font-size: var(--lumo-font-size-s); + gap: var(--lumo-space-s); + + .count { + color: var(--lumo-shade-60pct); + } + + vaadin-checkbox { + font-size: var(--lumo-font-size-s); + --vaadin-checkbox-size: var(--lumo-font-size-s); + + // Checkbox style can't be matched with current design tokens + &::part(checkbox) { + // border-radius: calc(var(--lumo-border-radius-s) / 2); + // background-color: transparent; + // border: 1px solid var(--lumo-shade-60pct); + margin-right: var(--lumo-space-s); + } + } + +} diff --git a/packages/cxl-ui/scss/cxl-filter-panel.scss b/packages/cxl-ui/scss/cxl-filter-panel.scss new file mode 100644 index 000000000..776e00b10 --- /dev/null +++ b/packages/cxl-ui/scss/cxl-filter-panel.scss @@ -0,0 +1,23 @@ + +:host { + display: block; + min-width: 240px; + + .content { + display: flex; + flex-direction: column; + } + vaadin-accordion-panel { + font-size: var(--lumo-font-size-s); + + &::part(summary-content) { + font-weight: 600; + color: var(--lumo-contrast); + font-size: var(--lumo-font-size-s); + } + + &::part(toggle) { + background-color: unset; + } + } +} diff --git a/packages/cxl-ui/scss/cxl-search-filters.scss b/packages/cxl-ui/scss/cxl-search-filters.scss new file mode 100644 index 000000000..43e6e0e7f --- /dev/null +++ b/packages/cxl-ui/scss/cxl-search-filters.scss @@ -0,0 +1,13 @@ +:host { + display: flex; + flex-direction: column; + align-items: start; + gap: var(--lumo-space-m); + + header { + color: var(--lumo-shade-60pct); + font-size: var(--lumo-font-size-s); + font-weight: 300; + text-transform: uppercase; + } +} diff --git a/packages/cxl-ui/src/components/cxl-filter-item.js b/packages/cxl-ui/src/components/cxl-filter-item.js new file mode 100644 index 000000000..e8552780f --- /dev/null +++ b/packages/cxl-ui/src/components/cxl-filter-item.js @@ -0,0 +1,25 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import { LitElement, html } from 'lit'; +import { customElement, property, state } from 'lit/decorators.js'; +import '@vaadin/checkbox'; +import cxlDashboardFilterItemStyles from '../styles/cxl-filter-item-css.js'; + +@customElement('cxl-filter-item') +export class CXLFilterItemElement extends LitElement { + static get styles() { + return [cxlDashboardFilterItemStyles]; + } + + @property({ type: String }) label = ''; + + @property({ type: String }) value = ''; + + @property({ type: Number }) count = 0; + + render () { + return html` + + (${this.count}) + ` + } +} diff --git a/packages/cxl-ui/src/components/cxl-filter-panel.js b/packages/cxl-ui/src/components/cxl-filter-panel.js new file mode 100644 index 000000000..bed604afb --- /dev/null +++ b/packages/cxl-ui/src/components/cxl-filter-panel.js @@ -0,0 +1,30 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import { LitElement, html } from 'lit'; +import { customElement, property, state } from 'lit/decorators.js'; +import './cxl-vaadin-accordion'; +import '@vaadin/accordion/vaadin-accordion-panel' +import cxlDashboardFilterPanelStyles from '../styles/cxl-filter-panel-css.js'; + +@customElement('cxl-filter-panel') +export class CXLFilterPanelElement extends LitElement { + static get styles() { + return [cxlDashboardFilterPanelStyles]; + } + + @property({ type: Boolean }) opened = ''; + + @property({ type: String }) label = ''; + + @property({ type: String }) value = ''; + + render () { + return html` + +
${this.label}
+
+ +
+
+ ` + } +} diff --git a/packages/cxl-ui/src/components/cxl-search-filters.js b/packages/cxl-ui/src/components/cxl-search-filters.js new file mode 100644 index 000000000..96c5e6e9e --- /dev/null +++ b/packages/cxl-ui/src/components/cxl-search-filters.js @@ -0,0 +1,32 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import { LitElement, html } from 'lit'; +import { customElement, property, state } from 'lit/decorators.js'; +import './cxl-vaadin-accordion'; +import cxlSearchFiltersStyles from '../styles/cxl-search-filters-css.js'; + +@customElement('cxl-search-filters') +export class CXLSearchFiltersElement extends LitElement { + static get styles() { + return [cxlSearchFiltersStyles]; + } + + @property({ type: String }) label = 'FILTER CONTENTS'; + + @property({ type: Number }) count = 0; + + render () { + return html` +
+ ${this.label} + (${this.count}) +
+ + + + + + Reset filters + + ` + } +} diff --git a/packages/storybook/cxl-ui/cxl-search-filters/cxl-filter-panel.stories.js b/packages/storybook/cxl-ui/cxl-search-filters/cxl-filter-panel.stories.js new file mode 100644 index 000000000..9d968ed69 --- /dev/null +++ b/packages/storybook/cxl-ui/cxl-search-filters/cxl-filter-panel.stories.js @@ -0,0 +1,30 @@ +import { html } from 'lit'; +import '@conversionxl/cxl-ui/src/components/cxl-filter-panel.js'; +import '@conversionxl/cxl-ui/src/components/cxl-filter-item.js'; + +export default { + title: 'CXL UI/cxl-search-filters', + parameters: { + layout: 'centered', + docs: { + description: { + component: 'CXL Search Filters Panels', + }, + }, + }, +} + +export const CXLFilterPanel = ({ label, filters }) => html` + + ${filters.map(filter => html``)} + +`; + +CXLFilterPanel.args = { + label: 'Categories', + filters: [ + { label: 'Brand Marketing', count: '10' }, + { label: 'Convertion Optimization', count: '20' }, + { label: 'Digital psychology and persuasion', count: '30' }, + ], +} diff --git a/packages/storybook/cxl-ui/cxl-search-filters/cxl-search-filters.stories.js b/packages/storybook/cxl-ui/cxl-search-filters/cxl-search-filters.stories.js new file mode 100644 index 000000000..beb7efd98 --- /dev/null +++ b/packages/storybook/cxl-ui/cxl-search-filters/cxl-search-filters.stories.js @@ -0,0 +1,34 @@ +import { html } from 'lit'; +import '@conversionxl/cxl-ui/src/components/cxl-vaadin-accordion'; +import '@conversionxl/cxl-ui/src/components/cxl-search-filters.js'; +import '@conversionxl/cxl-ui/src/components/cxl-filter-panel.js'; +import { CXLFilterPanel } from './cxl-filter-panel.stories'; + + +export default { + title: 'CXL UI/cxl-search-filters', + parameters: { + layout: 'centered', + docs: { + description: { + component: 'CXL Search Filters', + }, + }, + }, +} +const tagsPanelArgs = { + label: 'Tags', + filters: [ + { label: 'A' }, + { label: 'B' }, + { label: 'C' }, + { label: 'D' }, + { label: 'E' }, + ] +} +export const CXLSearchFilters = () => html` + + ${CXLFilterPanel(CXLFilterPanel.args)} + ${CXLFilterPanel(tagsPanelArgs)} + +`;