Skip to content

Commit

Permalink
Merge pull request #288 from conversionxl/kertu/feat/dashboard-catego…
Browse files Browse the repository at this point in the history
…ry-accordion
  • Loading branch information
pawelkmpt authored Aug 11, 2023
2 parents 1f2520d + bb5e8ee commit b02e9c2
Show file tree
Hide file tree
Showing 7 changed files with 268 additions and 6 deletions.
15 changes: 14 additions & 1 deletion packages/cxl-lumo-styles/scss/themes/cxl-tabs-slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
}
}

:host([theme~="cxl-course-slider"][overflow="start end"]) {
:host([theme~="cxl-course-slider"][overflow="start end"]),
:host([theme~="cxl-course-slider"][overflow="start"]) {
&::before {
left: 0;
z-index: 1;
Expand All @@ -109,3 +110,15 @@
opacity: 100%;
}
}

/**
* Theme "cxl-course-slider" and "cxl-category-accordion"
*/

:host([theme~="cxl-course-slider"][theme~="cxl-category-accordion"][theme~="minimal"]) {
margin-left: calc(-1 * var(--lumo-space-m));

@media #{mq.$small} {
margin-left: calc(-1 * var(--lumo-space-l));
}
}
39 changes: 39 additions & 0 deletions packages/cxl-lumo-styles/scss/themes/vaadin-accordion-panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,42 @@
padding-bottom: var(--lumo-space-m);
}
}

/**
* Theme "cxl-dashboard-category".
*/
:host([theme~="cxl-dashboard-category"]) {
border-bottom: solid 1px var(--cxl-color-light-gray);

[part="summary"] {
padding: var(--lumo-space-l) 0;
}

[part="content"] {
padding: 0;
margin-bottom: var(--lumo-space-l);
}

[part="toggle"] {
margin-right: var(--lumo-space-l);
}
}

:host([theme~="cxl-dashboard-category"][opened]) {
[part="summary"] {
padding-bottom: 0;
}
}

@media (hover: hover) {
:host([theme~="cxl-dashboard-category"]:not([opened])) {
[part="summary"]:hover {
cursor: pointer;
background-color: var(--cxl-color-light-gray);

[part="toggle"] {
color: var(--lumo-shade);
}
}
}
}
70 changes: 70 additions & 0 deletions packages/cxl-ui/scss/global/cxl-vaadin-accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,74 @@ cxl-vaadin-accordion {
}
}
}

/**
* Theme "cxl-dashboard-category"
*/
&[theme~="cxl-dashboard-category"] {
.header {
display: flex;
align-items: baseline;
padding: var(--lumo-space-l) var(--lumo-space-m);

@media #{mq.$small} {
padding: var(--lumo-space-l);
}

.entry-title {
margin: 0;
}

> span {
margin: 0 0 0 var(--lumo-space-m);
font-size: var(--lumo-font-size-xs);
font-weight: 600;
color: var(--lumo-primary-color);
text-transform: uppercase;
}
}

.summary {
padding: 0 var(--lumo-space-m) var(--lumo-space-l);

@media #{mq.$small} {
padding: 0 var(--lumo-space-l);
}
}

.summary-header {
display: flex;
align-items: center;

&:not(:first-of-type) {
padding-top: var(--lumo-space-l);
margin-top: var(--lumo-space-l);
border-top: 1px solid var(--cxl-color-light-gray);
}

h5 {
margin: 0;
font-size: var(--lumo-font-size-m);
}

vaadin-progress-bar {
width: 100px;
margin-left: var(--lumo-space-m);
}

a {
margin-left: auto;
}
}

.summary-cards {
h6 {
margin-bottom: var(--lumo-space-s);
font-size: var(--lumo-font-size-xs);
font-weight: 400;
line-height: 2;
opacity: 50%;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default {
title: 'CXL UI/cxl-light-card',
};

const Template = ({ numberOfCards }) => html`
<cxl-tabs-slider theme="cxl-course-slider minimal">
export const CXLLightCardSlider = ({ numberOfCards, theme }) => html`
<cxl-tabs-slider theme="cxl-course-slider minimal ${theme}">
${Array.from(
{ length: numberOfCards },
() => html`
Expand All @@ -23,9 +23,7 @@ const Template = ({ numberOfCards }) => html`
</cxl-tabs-slider>
`;

export const LightCardSlider = Template.bind({});

LightCardSlider.args = {
CXLLightCardSlider.args = {
numberOfCards: 3,
};

Expand Down
3 changes: 3 additions & 0 deletions packages/storybook/cxl-ui/cxl-vaadin-accordion.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CXLPlaybookAccordion } from './cxl-vaadin-accordion/cxl-playbook-accord
import { CXLVaadinAccordionThemeVaadin } from './cxl-vaadin-accordion/vaadin-accordion-panel[theme=vaadin].story';
import { CXLVaadinAccordionThemeFaq } from './cxl-vaadin-accordion/theme=cxl-faq.story';
import { CXLVaadinAccordionThemeMinidegreeTrack } from './cxl-vaadin-accordion/theme=cxl-minidegree-track.story';
import { CXLVaadinAccordionThemeCategory } from './cxl-vaadin-accordion/theme=cxl-dashboard-category.story';
import { CXLHubsAndPlaybooks } from './cxl-vaadin-accordion/cxl-hubs-and-playbooks.story';

export default {
Expand All @@ -22,6 +23,7 @@ CXLVaadinAccordionThemeArchive.storyName = 'cxl-accordion-card';
CXLVaadinAccordionThemeFaq.storyName = '[theme=cxl-faq]';
CXLVaadinAccordionThemeMinidegreeTrack.storyName = '[theme=cxl-minidegree-track]';
CXLVaadinAccordionThemeVaadin.storyName = 'vaadin-accordion-panel[theme=vaadin]';
CXLVaadinAccordionThemeCategory.storyName = '[theme=cxl-dashboard-category]';
CXLHubsAndPlaybooks.storyName = 'cxl-hubs-and-playbooks';

export {
Expand All @@ -30,5 +32,6 @@ export {
CXLVaadinAccordionThemeFaq,
CXLVaadinAccordionThemeMinidegreeTrack,
CXLVaadinAccordionThemeVaadin,
CXLVaadinAccordionThemeCategory,
CXLHubsAndPlaybooks,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[
{
"id": 1,
"title": "Deep skills",
"completion": "10% complete",
"sections": [
{
"title": "Growth",
"progress": "0.50",
"action": "View all",
"items": [
{
"title": "Demand capture",
"cards": []
},
{
"title": "Sub category",
"cards": []
}
]
},
{
"title": "Category",
"progress": "0.50",
"action": "View all",
"items": [
{
"title": "Demand capture",
"cards": []
}
]
}
]
},
{
"id": 2,
"title": "Broad skills",
"completion": "10% complete",
"sections": [
{
"title": "Growth",
"progress": "0.50",
"action": "View all",
"items": [
{
"title": "Demand capture",
"cards": []
}
]
}
]
},
{
"id": 3,
"title": "Fast skills",
"completion": "0% complete",
"sections": [
{
"title": "Growth",
"items": [
{
"title": "Demand capture",
"cards": []
},
{
"title": "Sub category",
"cards": []
}
]
}
]
},
{
"id": 4,
"title": "Learning history",
"sections": [
{
"title": "Growth",
"items": [
{
"title": "Demand capture",
"cards": []
}
]
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { html } from 'lit';
import '@conversionxl/cxl-ui/src/components/cxl-vaadin-accordion.js';
import '@vaadin/progress-bar';
import categoryData from './theme=cxl-dashboard-category.data.json';
import { CXLLightCardSlider } from '../cxl-light-card/light-card-slider.stories';

export const CXLVaadinAccordionThemeCategory = () => html`
<cxl-vaadin-accordion
id="cxl-vaadin-accordion-26107"
class="archive archive-category plural"
theme="cxl-dashboard-category"
>
${categoryData.map(
(el) => html`
<vaadin-accordion-panel theme="cxl-dashboard-category reverse" data-step-id="${el.id}">
<header class="entry-header header" slot="summary">
<h4 class="entry-title no-anchor" itemprop="headline">${el.title}</h4>
<span>${el.completion}</span>
</header>
<div class="entry-summary summary" itemprop="description">
${el.sections.map(
(section) => html`
<div class="summary-header">
<h5>${section.title}</h5>
<vaadin-progress-bar value="${section.progress}"></vaadin-progress-bar>
<a href="">${section.action}</a>
</div>
${section.items.map(
(item) => html`
<div class="summary-cards">
<h6>${item.title}</h6>
${CXLLightCardSlider(CXLLightCardSlider.args)}
</div>
`
)}
`
)}
</div>
</vaadin-accordion-panel>
`
)}
</cxl-vaadin-accordion>
`;


Object.assign(CXLLightCardSlider, {
args: {
numberOfCards: 8,
theme: 'cxl-category-accordion'
},
});

0 comments on commit b02e9c2

Please sign in to comment.