Skip to content

Commit

Permalink
feat(cxl-ui): cxl-course-card update styles when on large devices
Browse files Browse the repository at this point in the history
  • Loading branch information
anoblet committed May 30, 2024
1 parent 2aeb35b commit 887fcbe
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
7 changes: 0 additions & 7 deletions packages/cxl-ui/scss/cxl-course-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ footer {
}
}

:host([theme~="course"]) {
.name {
font-size: var(--lumo-font-size-m);
-webkit-line-clamp: unset;
}
}

:host([theme~="minidegree"]) {
.info {
max-width: unset;
Expand Down
9 changes: 9 additions & 0 deletions packages/cxl-ui/scss/global/cxl-course-card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cxl-tabs-slider {
cxl-course-card[theme~="course"] {
&::part(name) {
-webkit-line-clamp: 3;

font-size: var(--lumo-font-size-m);
}
}
}
13 changes: 12 additions & 1 deletion packages/cxl-ui/src/components/cxl-course-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
import { customElement, property, state } from 'lit/decorators.js';
import '@vaadin/details';
import '@vaadin/button';
import { registerGlobalStyles } from '@conversionxl/cxl-lumo-styles/src/utils';
import cxlCourseCardGlobalStyles from '../styles/global/cxl-course-card-css.js';
import cxlCourseCardStyles from '../styles/cxl-course-card-css.js';
import { CXLBaseCardElement } from './cxl-base-card.js';

Expand All @@ -27,12 +29,21 @@ export class CXLCourseCardElement extends CXLBaseCardElement {
}
_renderHeaderName() {
return html`<h3 class="name" title=${this.name}>
return html`<h3 class="name" part="name" title=${this.name}>
<a href=${this.ctaUrl}>${unsafeHTML(this.name)}</a>
${this.completed ? html`<vaadin-icon icon="lumo:checkmark"></vaadin-icon>` : nothing}
</h3>`;
}
firstUpdated(_changedProperties) {
super.firstUpdated(_changedProperties);
// Global styles.
registerGlobalStyles(cxlCourseCardGlobalStyles, {
moduleId: 'cxl-course-card-global',
});
}

render() {
return html`
<div class="container">
Expand Down

0 comments on commit 887fcbe

Please sign in to comment.