Skip to content

Commit

Permalink
fix(cxl-ui): fix course card layout issues
Browse files Browse the repository at this point in the history
  • Loading branch information
freudFlintstone committed Sep 27, 2023
1 parent f561d10 commit a4520ae
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 32 deletions.
4 changes: 3 additions & 1 deletion packages/cxl-ui/scss/cxl-base-card.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix -- some of these are necessary for line-clamp implementation */
@use "~@conversionxl/cxl-lumo-styles/scss/mq";
@use "~@conversionxl/cxl-ui/scss/mixins";

:host {
position: relative;
box-sizing: border-box;
display: flex;
width: 100%;
max-width: calc(100% - 2 * var(--lumo-space-l));
height: max-content;
padding: var(--lumo-space-m) var(--lumo-space-l);
font-size: var(--lumo-font-size-s);
Expand All @@ -33,6 +33,7 @@

header .info .attributes {
display: flex;
align-items: center;
}
}

Expand Down Expand Up @@ -141,6 +142,7 @@ header {
}

.name {
@include mixins.ellipsis-for-lines(3);
font-family: var(--lumo-font-family);
font-size: var(--lumo-font-size-xl);
font-style: normal;
Expand Down
21 changes: 17 additions & 4 deletions packages/cxl-ui/scss/cxl-course-card.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix -- some of these are necessary for line-clamp implementation */
/* stylelint-disable declaration-no-important */

@use "~@conversionxl/cxl-ui/scss/mixins";

:host {
Expand All @@ -9,14 +11,25 @@
box-shadow: var(--lumo-box-shadow-s);
}

header .name {
@include mixins.ellipsis-for-lines(3);
header {
.name {
@include mixins.ellipsis-for-lines(3);
}

.info {
overflow: visible;

cxl-time,
.instructor {
white-space: nowrap;
}
}
}

.content-wrapper {
height: 100%;
min-height: calc(var(--lumo-line-height-s) * 6); // Six standard line-heights
line-height: var(--lumo-line-height-s);
height: 100%;

.content {
@include mixins.ellipsis-for-lines(5);
Expand All @@ -40,8 +53,8 @@ header .name {
}

footer {
display: flex;
position: relative;
display: flex;
justify-content: end;

vaadin-details[theme="reverse"] {
Expand Down
5 changes: 5 additions & 0 deletions packages/storybook/.storybook/preview-body.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<style>
#root {
max-width: 100vw;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ CXLCourseCardPlaybook.args = {
time: '12 days ago',
description:
'Master the strategies, tactics, metrics, and wisdom you need to become an ABM leader and accelerate the growth of your company and of your career.',
tags: ['Growth Marketing'],
tags: 'Growth Marketing',
showTimeIcon: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ CXLCourseCardTraining.args = {
...args,
theme: 'training',
name: 'A/B testing mastery',
description: 'Understand testing approaches that work (and pitfalls that don’t) to get more wins and insights from optimization efforts.',
tags: ['CRO', 'Branding'],
description:
'Understand testing approaches that work (and pitfalls that don’t) to get more wins and insights from optimization efforts.',
tags: 'CRO, Branding',
showTimeIcon: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ CXLCourseCardVideo.args = {
...args,
theme: 'video',
name: 'A/B testing mastery',
description: 'Understand testing approaches that work (and pitfalls that don’t) to get more wins and insights from optimization efforts.',
description:
'Understand testing approaches that work (and pitfalls that don’t) to get more wins and insights from optimization efforts.',
contentTags: 'running experiments | customer base studies | prioritization',
tags: ['CRO'],
tags: 'CRO',
time: '4 days ago',
new: true,
showTimeIcon: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { html } from 'lit';
import '@conversionxl/cxl-ui/src/components/cxl-light-card.js';
import '@conversionxl/cxl-ui/src/components/cxl-tabs-slider.js';
import '@conversionxl/cxl-lumo-styles';
import { CXLCourseCard } from './[theme=course|lesson].stories.js';

export default {
title: 'CXL UI/cxl-course-card',
};

export const CXLCourseCardSlider = ({ numberOfCards, theme }) => html`
<style>
cxl-course-card {
max-width: 400px !important;
}
</style>
<cxl-tabs-slider theme="cxl-course-slider minimal ${theme}">
${Array.from(
{ length: numberOfCards },
() => html`
<vaadin-tab theme="cxl-course-slider"
>${CXLCourseCard({
...CXLCourseCard.args,
})}</vaadin-tab
>
`
)}
</cxl-tabs-slider>
`;

CXLCourseCardSlider.args = {
numberOfCards: 3,
};
12 changes: 2 additions & 10 deletions packages/storybook/cxl-ui/cxl-course-card/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
import { html } from 'lit';

const renderTags = (tags, slot) =>
tags.map(
(tag, i) =>
html`${i > 0 ? html`<span slot=${slot}> | </span>` : ''}<span
class="tag"
slot=${slot}
title="${tag}"
>${tag}</span
>`
);
html`<span class="tag" slot=${slot} title="${tags}">${tags}</span>`;

export const CourseCardTemplate = (course) => html`
<cxl-course-card
Expand Down Expand Up @@ -45,7 +37,7 @@ export const args = {
'Master the strategies, tactics, metrics, and wisdom you need to become an ABM leader and accelerate the growth of your company and of your career.',
contentTags: 'B2B | campaigns | pilot planning',
theme: 'course',
tags: ['Marketing', 'Analytics'],
tags: 'Marketing, Analytics, Growth, Demand Capture',
avatar:
'https://cxl.com/institute/wp-content/uploads/2020/05/48192546_10156982340630746_8127333122065825792_n-wpv_400pxx400px_center_center.jpg',
new: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ export default {
title: 'CXL UI/cxl-featured-course-card',
};

const renderTags = (tags, slot) =>
tags.map(
(tag, i) =>
html`${i > 0 ? html`<span slot=${slot}> | </span>` : ''}<span slot=${slot}>${tag}</span>`
);
const renderTags = (tags, slot) => tags.map((tag) => html`<span slot=${slot}>${tag}</span>`);

const FeaturedCourseCardTemplate = (course) => html`
<cxl-featured-course-card
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
import { html } from 'lit';
import '@conversionxl/cxl-ui/src/components/cxl-vaadin-accordion.js';
import '@vaadin/progress-bar';
Expand Down Expand Up @@ -31,11 +32,11 @@ export const CXLVaadinAccordionThemeCategory = () => html`
<div class="section-3">
<h6 class="title-3">${item.title}</h6>
${item.sections.map(
(section) => html`
<div class="section-4">
<h6 class="title-4">${section.title}</h6>
${CXLLightCardSlider(CXLLightCardSlider.args)}
</div>
(itemSection) => html`
<div class="section-4">
<h6 class="title-4">${itemSection.title}</h6>
${CXLLightCardSlider(CXLLightCardSlider.args)}
</div>
`
)}
</div>
Expand All @@ -51,10 +52,9 @@ export const CXLVaadinAccordionThemeCategory = () => html`
</cxl-vaadin-accordion>
`;


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

0 comments on commit a4520ae

Please sign in to comment.