From b22795a5a11b564c55ccb4f3fb1c629c85f55284 Mon Sep 17 00:00:00 2001 From: Andrew Noblet Date: Tue, 13 Aug 2024 16:11:34 +0000 Subject: [PATCH] refactor(cxl-ui): add course cards locked state https://app.clickup.com/t/86b1nztyh --- packages/cxl-lumo-styles/src/icons.js | 3 ++- packages/cxl-ui/scss/cxl-base-card.scss | 16 ++++++++++++++++ packages/cxl-ui/scss/cxl-light-card.scss | 9 +++++++++ packages/cxl-ui/src/components/cxl-base-card.js | 5 +++++ packages/cxl-ui/src/components/cxl-light-card.js | 7 ++++--- .../storybook/cxl-ui/cxl-course-card/template.js | 2 ++ .../cxl-ui/cxl-light-card/default.stories.js | 1 + .../storybook/cxl-ui/cxl-light-card/template.js | 1 + 8 files changed, 40 insertions(+), 4 deletions(-) diff --git a/packages/cxl-lumo-styles/src/icons.js b/packages/cxl-lumo-styles/src/icons.js index 6671987ed..92fb25f6f 100644 --- a/packages/cxl-lumo-styles/src/icons.js +++ b/packages/cxl-lumo-styles/src/icons.js @@ -80,6 +80,7 @@ $documentContainer.innerHTML = ` + @@ -96,7 +97,7 @@ $documentContainer.innerHTML = ` font-family: vaadin-icons; font-style: normal; font-weight: initial; - src: url(data:application/octet-stream;base64,d09GMgABAAAAAAo8AAsAAAAAEvwAAAntAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGVgCEdgqWIJE2ATYCJAM8CyAABCAFhEYHgVsbrA8jESacVE721wncHDI7WhWEyKRrNu4ymBTMQ1S0W9IDx6DvMnFfODgmeP7br92Z990Sm3ANhWSJRIwbEUuEJtayzRwiIe3wtM1/hAiH9pFlz2ljrrD64KwI2Bq2JsxAV1HEfvkjKwAIcnfbt8DLOMPf8kBDjzhqIbjBPm1IMAbyf19tfzZfbVgZFqiMfXu7f7EtB0FOCD/k7H/HUkukgBVRCsKi9JcU/6UpcO7KdICuoABYKHoeGFwlb5PzrPWk2iGehQ/maqfUtpugQGQNRAPsiE1GgEOWtDcCJsATgxVcZZU1VSWA+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x948WTcy79+O5dPcXqZx1ydn2G9c+CONS36s5IQvhR5UOSO6moWsSgm52sj9xZf934aoLxjmY5m1PP5VdLrglcSORc716szvlggvuDJKDnf4ruCNxfzI7UCZpqxpx6bIlHiw9e+yYsF4YZeSmnNiW7JpbmUrZHd/jOE785PCJM4MaEJUY7wGiNxt2/450xLg7x+/3Gb70OE3gGZwXGlIYCghdOoBvljaEJhVaZgSB/jmXKYafvwGseyIJ0jenfyS52tkeaPMNzZaFq3wSAxK8E6kZjMztrUFVa1Oy4zLcqyXlVYzYABDyHxASkw++ENh0qdUtuKxFZQ0u8/9VyE+ov+z+F9qMK/a9K+vTcr8W+H8BNWV0M8HoJyYrw1X3v9S/vpYvztGx3Moix8hfiWTcF6iaL6qjkGD5BmVyBDRyh79ycyA/Ree36N8oEf4SROQ0oHY3ORxEuKSs3MULFWkOIugAr9pZBbhHqHpZjHC55r9HYBCb1VjXMRy5u2KL4MUZ7kD0xjbi5WI1aAA4qpBe45nSddcyNyDEcBEcbHjN3dUBC3jY8JuMyJkRif9abAYz/m8CcCnrZCnXNwxjDxys437PF3JNlNXObKMudsKMDIJONauqU9iLeOWZBnWkjE7V96QKU4tWTBQph83GUw1jaTibACRdylrnluwfrb5hGHvgHI2K8/6FXMnv/Kmd2ebUPdGc2zsIOt6sOpFeFvYC3CsVmMBg02M5khN6APqhJb6sRUvFJpYoK4cNNOXzUtMwG7YxZVM1KI6QY5KsqJpumJ5+D71sx/WeyiLaTtvEtsfbySwbMMvr2D5JKjVV7Uiqnp5xEeQMve5T7u48WGyIuitf1XPpYS17dE2P/yMJak4hylUV4EeJ49BUMnDOz26WpnuaM5ZHW1LTrcxJako6OwMAAA==) format("woff2"); + src: url(data:application/octet-stream;base64,d09GMgABAAAAAArEAAsAAAAAE+gAAAp1AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGVgCFDAqXaJJQATYCJANACyIABCAFhEYHgWIbZxAjETaMk+Il+8sEbg5ocS2rlWHCqMeoaZsehu9H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/bgpzewUzRFkrtIsN+Am1YX3umDVhVVH3hcmVA0qCnnQ7H1PPMRtkE81cqAykmHluhitCtAE1ppBzPCg2XrANcsrW0u5IV2VEz1w6ywxyqtq0DmET8MhRooo6GtGMVjzKL9CNXvRjEMOguTyxoAJXrqoIJ+uZkyDTzeI+iivNNd4jNT5ewUxQs4w8uhxOtVTQIYbDHPUboApXJcpdC4fnePE1IAGvzlg6bCTrBdkhdZT6T/kqTeR4JiYP5SIuyfGEJke9yRcLAAA=); } html { diff --git a/packages/cxl-ui/scss/cxl-base-card.scss b/packages/cxl-ui/scss/cxl-base-card.scss index 0c4d0db8c..8fe881b54 100644 --- a/packages/cxl-ui/scss/cxl-base-card.scss +++ b/packages/cxl-ui/scss/cxl-base-card.scss @@ -220,6 +220,15 @@ header { display: none; } +.icon-lock { + color: var(--lumo-body-text-color); + + :host([theme~="category"]) &, + :host([theme~="minidegree"]) & { + color: var(--lumo-tint); + } +} + :host([new]) { .icon-new { position: absolute; @@ -249,3 +258,10 @@ vaadin-button { } } } + +:host([locked]) { + header, .content-wrapper { + opacity: 0.6; + } + +} diff --git a/packages/cxl-ui/scss/cxl-light-card.scss b/packages/cxl-ui/scss/cxl-light-card.scss index bcd06e11f..17ed32611 100644 --- a/packages/cxl-ui/scss/cxl-light-card.scss +++ b/packages/cxl-ui/scss/cxl-light-card.scss @@ -177,3 +177,12 @@ } } } + +.icon-lock { + position: absolute; + top: var(--lumo-space-s); + right: var(--lumo-space-s); + z-index: 2; + width: var(--lumo-icon-size-s); + height: var(--lumo-icon-size-s); +} diff --git a/packages/cxl-ui/src/components/cxl-base-card.js b/packages/cxl-ui/src/components/cxl-base-card.js index cdd50d10b..f5f5b0dec 100644 --- a/packages/cxl-ui/src/components/cxl-base-card.js +++ b/packages/cxl-ui/src/components/cxl-base-card.js @@ -18,6 +18,10 @@ export class CXLBaseCardElement extends LitElement { @property({ type: String }) id = ''; + @property({ type: Boolean, reflect: true }) locked; + + @property({ type: String, attribute: 'locked-message' }) lockedMessage = 'Purchase an All-Access subscription to unlock this course.'; + @property({ type: String }) theme = ''; @property({ type: String }) name = ''; @@ -50,6 +54,7 @@ export class CXLBaseCardElement extends LitElement { ${this.theme && this._tagsHasChildren ? this.separator : ''} ${this.new ? html`${this.theme ? this.separator : ''}NEW` : ''} + ${this.locked ? html`${this.theme ? this.separator : ''}` : ''} `; } diff --git a/packages/cxl-ui/src/components/cxl-light-card.js b/packages/cxl-ui/src/components/cxl-light-card.js index 33855ecf0..feda2b485 100644 --- a/packages/cxl-ui/src/components/cxl-light-card.js +++ b/packages/cxl-ui/src/components/cxl-light-card.js @@ -43,9 +43,10 @@ export class CXLLightCardElement extends CXLBaseCardElement { _renderHeaderName() { return html`

- ${unsafeHTML(this.name)}${ - this.completed ? html`` : nothing - } + ${unsafeHTML(this.name)}${ + this.completed ? html`` : nothing + } + ${this.locked ? html`` : ''}

`; } diff --git a/packages/storybook/cxl-ui/cxl-course-card/template.js b/packages/storybook/cxl-ui/cxl-course-card/template.js index 3be7e825d..034b57ffc 100644 --- a/packages/storybook/cxl-ui/cxl-course-card/template.js +++ b/packages/storybook/cxl-ui/cxl-course-card/template.js @@ -9,6 +9,7 @@ export const CourseCardTemplate = (course) => html` html` export const args = { id: 'cxl-course-1', + locked: false, name: 'Account based marketing', time: '3h 00min', instructor: 'Tom Wesseling', diff --git a/packages/storybook/cxl-ui/cxl-light-card/default.stories.js b/packages/storybook/cxl-ui/cxl-light-card/default.stories.js index 55f9f3320..27b3a706e 100644 --- a/packages/storybook/cxl-ui/cxl-light-card/default.stories.js +++ b/packages/storybook/cxl-ui/cxl-light-card/default.stories.js @@ -16,6 +16,7 @@ export const CXLLightCardMinidegree = Template.bind({}); export const CXLLightCardFooter = Template.bind({}); CXLLightCard.args = { + locked: false, theme: 'light-card', new: false, completed: false, diff --git a/packages/storybook/cxl-ui/cxl-light-card/template.js b/packages/storybook/cxl-ui/cxl-light-card/template.js index 354920d9b..f887cf9ee 100644 --- a/packages/storybook/cxl-ui/cxl-light-card/template.js +++ b/packages/storybook/cxl-ui/cxl-light-card/template.js @@ -3,6 +3,7 @@ import { unsafeHTML } from 'lit/directives/unsafe-html.js'; export const Template = (card) => html`