forked from web-padawan/aybolit
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cxl-ui): add cxl-dashboard-section component
- Loading branch information
1 parent
82b720e
commit 3d5db89
Showing
10 changed files
with
362 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
@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; | ||
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 { | ||
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/storybook/cxl-ui/cxl-dashboard/cxl-dashboard-section.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { html } from 'lit'; | ||
import '@conversionxl/cxl-ui/src/components/cxl-dashboard-section.js'; | ||
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, | ||
}; |
Oops, something went wrong.