Skip to content

Commit

Permalink
Merge pull request #348 from conversionxl/raphael/feat/dashboard/no-a…
Browse files Browse the repository at this point in the history
…ccordion
  • Loading branch information
pawelkmpt authored Nov 8, 2023
2 parents 4483d0a + b89d4cc commit 12b3c34
Show file tree
Hide file tree
Showing 9 changed files with 366 additions and 6 deletions.
12 changes: 12 additions & 0 deletions packages/cxl-ui/scss/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,15 @@
-moz-box-orient: vertical;
/* stylelint-enable */
}

@mixin primary-link-with-arrow {
&::after {
padding: calc(var(--lumo-space-xs) / 2);
margin-left: var(--lumo-space-s);
font-family: lumo-icons;
font-size: var(--lumo-font-size-s);
content: var(--lumo-icons-angle-right);
background-color: var(--lumo-primary-color-10pct);
border-radius: var(--lumo-font-size-s);
}
}
7 changes: 7 additions & 0 deletions packages/cxl-ui/scss/cxl-dashboard-section.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@use "~@conversionxl/cxl-lumo-styles/scss/mq";

:host {
position: relative;
display: block;
width: 100%;
}
162 changes: 162 additions & 0 deletions packages/cxl-ui/scss/global/cxl-dashboard-section.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
@use "~@conversionxl/cxl-lumo-styles/scss/mq";
@use "../mixins";

/**
* Theme "cxl-dashboard-category"
*/
cxl-dashboard-section {
padding-bottom: var(--lumo-space-xl);

.header {
--lumo-header-text-color: var(--lumo-tint);

position: relative;
box-sizing: border-box;
min-height: 240px;
padding: var(--lumo-space-xl) 0;
margin-bottom: var(--lumo-space-l);
background-color: var(--lumo-shade);

&::before {
position: absolute;
top: 0;
bottom: 0;
left: 50%;
z-index: -1;
width: 100vw;
content: "";
background-color: var(--lumo-shade);
transform: translateX(-50%);
}

.entry-title {
margin: 0;
font-weight: 900;
}

.entry-summary {
max-width: 480px;
padding: 0;
margin: var(--lumo-space-m) 0;
color: var(--lumo-tint);
}

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

> .view-all {
@include mixins.primary-link-with-arrow();
}
}

.header-2 {
display: flex;
align-items: center;
padding: var(--lumo-space-s) 0;

.title-2 {
margin-right: auto;
}

a {
margin-left: auto;
color: var(--lumo-base);

.title {
text-decoration: underline;
}

.view-all {
display: none;
font-size: var(--lumo-font-size-m);
font-weight: 500;
}
}

&:hover {
a {
color: var(--lumo-primary-color);
text-decoration: none;

@media #{mq.$small} {
.view-all {
display: initial;
margin-left: var(--lumo-space-m);
text-decoration: none;

@include mixins.primary-link-with-arrow();
}
}
}
}

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

.progress-label {
display: none;

@media #{mq.$small} {
display: initial;
}
}
}

.title-2,
.title-3,
.title-4 {
margin: 0;
}

.title-3 {
padding: var(--lumo-space-s) 0;
}

.title-4 {
padding: var(--lumo-space-s) 0;
font-weight: 400;
color: var(--cxl-color-black-50pct);
}

cxl-tabs-slider {
padding: var(--lumo-space-s) 0;
}

.section-2:not(.has-cards):not(:first-of-type) {
padding-top: var(--lumo-space-m);
margin-top: var(--lumo-space-m);
border-top: 1px solid var(--cxl-color-light-gray);
}

.section-2.has-cards:not(:last-of-type),
.section-3:not(:last-of-type) {
padding-bottom: var(--lumo-space-m);
margin-bottom: var(--lumo-space-m);
border-bottom: solid 1px var(--cxl-color-light-gray);
}

.section-2.has-cards > .section-3:not(.section-3 ~ .section-3),
.section-3.has-cards .section-4:first-of-type {
padding-top: var(--lumo-space-m);
margin-top: var(--lumo-space-m);
border-top: solid 1px var(--cxl-color-light-gray);
}

.section-4 {
.title-3 {
opacity: 0.5;
}

.entry-title {
display: flex;
align-items: center;
gap: var(--lumo-space-s);
}
}
}
28 changes: 28 additions & 0 deletions packages/cxl-ui/src/components/cxl-dashboard-section.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-disable import/no-extraneous-dependencies */
import { LitElement, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { registerGlobalStyles } from '@conversionxl/cxl-lumo-styles/src/utils';
import cxlDashboardSectionGlobalStyles from '../styles/global/cxl-dashboard-section-css.js';
import cxlDashboardSectionStyles from '../styles/cxl-dashboard-section-css.js';

@customElement('cxl-dashboard-section')
export class CxlDashboardSectionElement extends LitElement {
static get styles() {
return [cxlDashboardSectionStyles];
}

@property({ type: String }) image = '';

render() {
return html` <slot></slot> `;
}

firstUpdated(_changedProperties) {
super.firstUpdated(_changedProperties);

// Global styles.
registerGlobalStyles(cxlDashboardSectionGlobalStyles, {
moduleId: 'cxl-dashboard-section',
});
}
}
4 changes: 3 additions & 1 deletion packages/cxl-ui/src/index-core.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
// Theme style modules must be imported before elements.
import '@conversionxl/cxl-lumo-styles';
import 'qrcode';
Expand All @@ -16,11 +17,12 @@ import * as Headroom from 'headroom.js';
export { CXLAppLayoutElement } from './components/cxl-app-layout.js';
export { CXLBaseCardElement } from './components/cxl-base-card.js';
export { CXLCardElement } from './components/cxl-card.js';
export { CXLCredentialElement } from './components/cxl-credential.js'
export { CXLCredentialElement } from './components/cxl-credential.js';
export { CXLCourseCardElement } from './components/cxl-course-card.js';
export { CXLCourseDialogElement } from './components/cxl-course-dialog.js';
export { CXLCheckoutDetailsElement } from './components/cxl-checkout-details.js';
export { CXLDashboardHeaderElement } from './components/cxl-dashboard-header.js';
export { CxlDashboardSectionElement } from './components/cxl-dashboard-section.js';
export { CXLDashboardNotificationElement } from './components/cxl-dashboard-notification.js';
export { CXLFeaturedCourseCardElement } from './components/cxl-featured-course-card.js';
export { CXLLightCardElement } from './components/cxl-light-card.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import '@conversionxl/cxl-ui/src/components/cxl-marketing-nav.js';
import { CXLMarketingNav } from '../cxl-marketing-nav.stories';
import { CXLDashboardHeader } from '../cxl-dashboard-header/dashboard-header.stories';
import { DashboardSlider } from '../cxl-featured-course-card/dashboard-slider.stories';
import { CXLVaadinAccordionThemeCategory } from '../cxl-vaadin-accordion.stories';
import { CXLFooterNav } from '../footer-nav.stories';
import { CXLDashboardSections } from './cxl-dashboard-sections.stories';

export default {
title: 'CXL UI/cxl-dashboard',
Expand All @@ -21,16 +21,15 @@ export const CXLDashboard = () => {
showRoadmapStats: true,
showRoadmapSlider: true,
editRoadmapLinkUrl: 'https://cxl.com',
showMinidegrees: true
showMinidegrees: true,
};

return html`
<cxl-app-layout id="container" layout="1c-w" theme="cxl-dashboard">
${CXLMarketingNav()}
<div>
${DashboardSlider()}
${CXLDashboardHeader(CXLDashboardHeader.args)}
${CXLVaadinAccordionThemeCategory()}
${DashboardSlider()} ${CXLDashboardHeader(CXLDashboardHeader.args)}
${CXLDashboardSections()}
</div>
${CXLFooterNav()}
</cxl-app-layout>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* eslint-disable import/no-extraneous-dependencies */
import { html } from 'lit';
import '@conversionxl/cxl-lumo-styles';
import '@conversionxl/cxl-ui/src/components/cxl-dashboard-section.js';
import '@vaadin/progress-bar';
import { CXLLightCardSlider } from '../cxl-light-card/light-card-slider.stories';

export default {
title: 'CXL UI/cxl-dashboard',
component: 'cxl-dashboard-section',
parameters: {
layout: 'centered',
},
};

const Template = (section) => html`
<cxl-dashboard-section image=${section.image}>
<header class="entry-header header">
<h2 class="entry-title no-anchor" itemprop="headline">${section.title}</h2>
<span>${section.completion}</span>
<div class="entry-summary summary" itemprop="description">${section.description}</div>
${section.ctaLabel && section.ctaUrl
? html`
<a href=${section.ctaUrl} class="${section.ctaButton ? 'button' : 'view-all'}">
${section.ctaButton
? html`
<vaadin-button theme="primary">
${section.ctaLabel}
<vaadin-icon icon="lumo:angle-right" slot="suffix"></vaadin-icon>
</vaadin-button>
`
: section.ctaLabel}
</a>
`
: ''}
</header>
<div class="entry-summary summary" itemprop="description">
<div class="section-2">
<div class="header-2">
<h4 class="title-2">
<a href="">
<span class="title">Growth</span>
<span class="view-all"> View All </span>
</a>
</h4>
<span class="progress-label">Progress: </span>
<vaadin-progress-bar value="0.5"></vaadin-progress-bar>
</div>
<div class="section-3">
<div class="section-4">
<div class="entry-title">
<h6 class="title-3">Demand Creation</h6>
/
<h6 class="title-4">Organic Content</h6>
</div>
${CXLLightCardSlider(CXLLightCardSlider.args)}
</div>
</div>
</div>
</div>
</cxl-dashboard-section>
`;
export const CXLDashboardSection = Template.bind({});

CXLDashboardSection.args = {
image: '',
title: 'Growth',
completion: '80% complete',
description: 'Master these skills and become and expert in Growth, CRO and Analytics.',
ctaLabel: 'Growth Marketing exam',
ctaUrl: '#',
ctaButton: false,
};
Loading

0 comments on commit 12b3c34

Please sign in to comment.