{this.renderCover()}
-
-
- {this.authors} -
- {this.renderOperaTitle()} +
+ {this.authors}
+ {this.renderOperaTitle()}
-
- Anche nella versione libro liquido con{" "} - this.emitImmersiveReaderClick()} - > - strumento di lettura immersiva - -
+ {this.variant === BookCardVariant.LANDSCAPE && ( +
+ Anche nella versione libro liquido con{" "} + this.emitImmersiveReaderClick()} + > + strumento di lettura immersiva + +
+ )}
- - ); - } - - private renderPortrait(): HTMLDivElement { - return
; - } - - render(): HTMLZBookCardElement { - return ( -
- {this.renderCard()}
); } diff --git a/src/components/book-card/z-book-card/styles.css b/src/components/book-card/z-book-card/styles.css index 8f06f3ded..89adfcf86 100755 --- a/src/components/book-card/z-book-card/styles.css +++ b/src/components/book-card/z-book-card/styles.css @@ -4,198 +4,244 @@ } :host > article { + width: 304px; + min-height: 686px; + box-sizing: border-box; + padding: var(--space-unit) 0; + border: solid var(--border-size-medium) var(--color-surface03); background-color: var(--color-surface01); + border-radius: var(--border-radius); color: var(--color-default-text); font-family: var(--font-family-sans); -} -/* Tablet breakpoint */ -@media (min-width: 768px) { - :host > article.landscape { - width: 635px; - min-height: 332px; - max-height: 428px; - box-sizing: border-box; - border: solid var(--border-size-medium) var(--color-surface03); - border-radius: var(--border-radius); - - .main-content { - display: flex; - height: 296px; - padding: calc(var(--space-unit) * 2); - gap: calc(var(--space-unit) * 2); + .main-content { + display: flex; + flex-direction: column; + gap: calc(var(--space-unit) * 2); - .cover { - display: flex; - overflow: hidden; - width: 221px; - border-radius: var(--border-radius); - - img { - max-width: 100%; - max-height: 100%; - align-self: end; - } + .cover { + display: flex; + overflow: hidden; + height: 378px; + margin: 0 var(--space-unit); + border-radius: var(--border-radius); + + img { + max-width: 100%; + max-height: 100%; + align-self: end; } + } - .card-info { + .card-info { + display: flex; + flex: 1; + flex-direction: column; + justify-content: space-between; + margin: 0 var(--space-unit); + gap: calc(var(--space-unit) * 2); + + .book-data { display: flex; flex: 1; flex-direction: column; justify-content: space-between; - gap: calc(var(--space-unit) * 2); + gap: var(--space-unit); + + .authors-title-cta-section { + display: grid; + column-gap: calc(var(--space-unit) * 2); + grid-template-areas: + "authors authors" + "title cta"; + grid-template-columns: auto 24px; + + .authors { + display: -webkit-box; + overflow: hidden; + height: 20px; + margin-bottom: calc(var(--space-unit) / 2); + -webkit-box-orient: vertical; + grid-area: authors; + -webkit-line-clamp: 1; + line-clamp: 1; + text-overflow: ellipsis; + } - .book-data { - display: flex; - flex: 1; - flex-direction: column; - justify-content: space-between; + .opera-title { + display: -webkit-box; + overflow: hidden; + height: 54px; + -webkit-box-orient: vertical; + grid-area: title; + -webkit-line-clamp: 2; + line-clamp: 2; + text-overflow: ellipsis; + + * { + all: unset; + } + } + } - .authors-title-cta-section { - display: flex; - gap: calc(var(--space-unit) * 2); - - .authors-title { - flex: 1; - - .authors { - display: -webkit-box; - overflow: hidden; - height: 20px; - margin-bottom: calc(var(--space-unit) / 2); - -webkit-box-orient: vertical; - -webkit-line-clamp: 1; - line-clamp: 1; - text-overflow: ellipsis; - } + .isbn-tags-link-section { + .isbn-tags-section { + margin-bottom: var(--space-unit); + + .volume-title { + display: -webkit-box; + overflow: hidden; + height: 20px; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + line-clamp: 1; + text-overflow: ellipsis; + } - .opera-title { - display: -webkit-box; - overflow: hidden; - height: 54px; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - line-clamp: 2; - text-overflow: ellipsis; - - * { - all: unset; - } - } + .isbn { + display: -webkit-box; + overflow: hidden; + height: 20px; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + line-clamp: 1; + text-overflow: ellipsis; } - } - .isbn-tags-link-section { - .isbn-tags-section { - margin-bottom: var(--space-unit); - - .volume-title { - display: -webkit-box; - overflow: hidden; - height: 20px; - -webkit-box-orient: vertical; - -webkit-line-clamp: 1; - line-clamp: 1; - text-overflow: ellipsis; - } + .tags { + display: flex; + overflow: hidden; + height: 22px; + flex-flow: wrap; + padding: calc(var(--space-unit) / 2) 0 var(--space-unit); + gap: var(--space-unit); - .isbn { - display: -webkit-box; - overflow: hidden; - height: 20px; - -webkit-box-orient: vertical; - -webkit-line-clamp: 1; - line-clamp: 1; - text-overflow: ellipsis; + z-tag.active { + --z-tag-bg: var(--color-primary03); + --z-tag-text-color: var(--color-default-text); } - .tags { - display: flex; - overflow: hidden; - height: 22px; - flex-flow: wrap; - padding: calc(var(--space-unit) / 2) 0; - gap: var(--space-unit); - - z-tag.active { - --z-tag-bg: var(--color-primary03); - --z-tag-text-color: var(--color-default-text); - } - - z-tag.disabled { - --z-tag-bg: var(--color-surface03); - --z-tag-text-color: var(--color-default-text); - } - - z-tag.interactive { - cursor: pointer; - } - - z-tag:focus { - box-shadow: var(--shadow-focus-primary); - outline: none; - } + z-tag.disabled { + --z-tag-bg: var(--color-surface03); + --z-tag-text-color: var(--color-default-text); } - } - .link-section { - display: flex; - height: 24px; - align-items: center; - justify-content: space-between; - gap: var(--space-unit); + z-tag.interactive { + cursor: pointer; + } - .adoption-tag { - padding: calc(var(--space-unit) / 2) var(--space-unit); - background-color: var(--green100); - border-radius: 100px; - text-transform: uppercase; + z-tag:focus { + box-shadow: var(--shadow-focus-primary); + outline: none; } } } - } - - .ebook-container { - height: 76px; - .ebook { + .link-section { display: flex; + height: 24px; align-items: center; justify-content: space-between; - padding: var(--space-unit); - background-color: var(--color-primary02); - border-radius: var(--border-radius); gap: var(--space-unit); - .app-name { - display: flex; - align-items: center; - padding: calc(var(--space-unit) / 2) 0; - font-family: var(--font-family-serif); - gap: calc(var(--space-unit) / 2); + .adoption-tag { + padding: calc(var(--space-unit) / 2) var(--space-unit); + background-color: var(--green100); + border-radius: 100px; + text-transform: uppercase; + } + } + } + } - .laz { - color: var(--red500); - } + .ebook-container { + height: 64px; + + .ebook { + display: flex; + align-items: center; + justify-content: space-between; + padding: calc(var(--space-unit) * 2) var(--space-unit); + background-color: var(--color-primary02); + border-radius: var(--border-radius); + gap: var(--space-unit); + + .app-name { + display: flex; + align-items: center; + padding: calc(var(--space-unit) / 2) 0; + font-family: var(--font-family-serif); + gap: calc(var(--space-unit) / 2); + + .laz { + color: var(--red500); } } } } } + } - ::slotted([slot="apps"]) { - border-top: solid var(--border-size-small) var(--color-surface03); - } + ::slotted([slot="cta"]) { + grid-area: cta; + } + + ::slotted([slot="apps"]) { + border-top: solid var(--border-size-small) var(--color-surface03); } } -/* Desktop breakpoint */ +:host > article.landscape { + width: 635px; + min-height: 332px; + max-height: 428px; + padding: 0; + + .main-content { + height: 296px; + flex-direction: row; + padding: calc(var(--space-unit) * 2); + + .cover { + display: flex; + overflow: hidden; + width: 221px; + height: auto; + margin: 0; + } + + .card-info { + margin: 0; + + .book-data { + gap: unset; -/* -@media (min-width: 1152px) { -} */ + .authors-title-cta-section { + grid-template-areas: + "authors cta" + "title title"; -/* Wide breakpoint */ + .authors { + margin-bottom: var(--space-unit); + } + } -/* @media (min-width: 1366px) { -} */ + .isbn-tags-link-section { + .isbn-tags-section { + .tags { + padding: calc(var(--space-unit) / 2) 0; + } + } + } + } + + .ebook-container { + height: 76px; + + .ebook { + padding: var(--space-unit); + } + } + } + } +} From f1fefe9db7aba2dc74ad0f53a6ee98d0f6ab1c4d Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Thu, 28 Nov 2024 15:07:18 +0100 Subject: [PATCH 04/26] feat!: avoid css nesting to increase browsers compatibility --- .../book-card/z-book-card/styles.css | 438 +++++++++--------- 1 file changed, 216 insertions(+), 222 deletions(-) diff --git a/src/components/book-card/z-book-card/styles.css b/src/components/book-card/z-book-card/styles.css index 89adfcf86..080156dd0 100755 --- a/src/components/book-card/z-book-card/styles.css +++ b/src/components/book-card/z-book-card/styles.css @@ -13,182 +13,180 @@ border-radius: var(--border-radius); color: var(--color-default-text); font-family: var(--font-family-sans); +} + +:host > article .main-content { + display: flex; + flex-direction: column; + gap: calc(var(--space-unit) * 2); +} + +:host > article .main-content .cover { + display: flex; + overflow: hidden; + height: 378px; + margin: 0 var(--space-unit); + border-radius: var(--border-radius); +} + +:host > article .main-content .cover img { + max-width: 100%; + max-height: 100%; + align-self: end; +} + +:host > article .main-content .card-info { + display: flex; + flex: 1; + flex-direction: column; + justify-content: space-between; + margin: 0 var(--space-unit); + gap: calc(var(--space-unit) * 2); +} + +:host > article .main-content .card-info .book-data { + display: flex; + flex: 1; + flex-direction: column; + justify-content: space-between; + gap: var(--space-unit); +} + +:host > article .main-content .card-info .book-data .authors-title-cta-section { + display: grid; + column-gap: calc(var(--space-unit) * 2); + grid-template-areas: + "authors authors" + "title cta"; + grid-template-columns: auto 24px; +} + +:host > article .main-content .card-info .book-data .authors-title-cta-section .authors { + display: -webkit-box; + overflow: hidden; + height: 20px; + margin-bottom: calc(var(--space-unit) / 2); + -webkit-box-orient: vertical; + grid-area: authors; + -webkit-line-clamp: 1; + line-clamp: 1; + text-overflow: ellipsis; +} + +:host > article .main-content .card-info .book-data .authors-title-cta-section .opera-title { + display: -webkit-box; + overflow: hidden; + height: 54px; + -webkit-box-orient: vertical; + grid-area: title; + -webkit-line-clamp: 2; + line-clamp: 2; + text-overflow: ellipsis; +} + +:host > article .main-content .card-info .book-data .authors-title-cta-section .opera-title * { + all: unset; +} + +:host > article .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section { + margin-bottom: var(--space-unit); +} + +:host > article .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section .volume-title { + display: -webkit-box; + overflow: hidden; + height: 20px; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + line-clamp: 1; + text-overflow: ellipsis; +} + +:host > article .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section .isbn { + display: -webkit-box; + overflow: hidden; + height: 20px; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + line-clamp: 1; + text-overflow: ellipsis; +} + +:host > article .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section .tags { + display: flex; + overflow: hidden; + height: 22px; + flex-flow: wrap; + padding: calc(var(--space-unit) / 2) 0 var(--space-unit); + gap: var(--space-unit); +} + +:host > article .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section .tags z-tag.active { + --z-tag-bg: var(--color-primary03); + --z-tag-text-color: var(--color-default-text); +} + +:host > article .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section .tags z-tag.disabled { + --z-tag-bg: var(--color-surface03); + --z-tag-text-color: var(--color-default-text); +} + +:host > article .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section .tags z-tag.interactive { + cursor: pointer; +} - .main-content { - display: flex; - flex-direction: column; - gap: calc(var(--space-unit) * 2); - - .cover { - display: flex; - overflow: hidden; - height: 378px; - margin: 0 var(--space-unit); - border-radius: var(--border-radius); - - img { - max-width: 100%; - max-height: 100%; - align-self: end; - } - } - - .card-info { - display: flex; - flex: 1; - flex-direction: column; - justify-content: space-between; - margin: 0 var(--space-unit); - gap: calc(var(--space-unit) * 2); - - .book-data { - display: flex; - flex: 1; - flex-direction: column; - justify-content: space-between; - gap: var(--space-unit); - - .authors-title-cta-section { - display: grid; - column-gap: calc(var(--space-unit) * 2); - grid-template-areas: - "authors authors" - "title cta"; - grid-template-columns: auto 24px; - - .authors { - display: -webkit-box; - overflow: hidden; - height: 20px; - margin-bottom: calc(var(--space-unit) / 2); - -webkit-box-orient: vertical; - grid-area: authors; - -webkit-line-clamp: 1; - line-clamp: 1; - text-overflow: ellipsis; - } - - .opera-title { - display: -webkit-box; - overflow: hidden; - height: 54px; - -webkit-box-orient: vertical; - grid-area: title; - -webkit-line-clamp: 2; - line-clamp: 2; - text-overflow: ellipsis; - - * { - all: unset; - } - } - } - - .isbn-tags-link-section { - .isbn-tags-section { - margin-bottom: var(--space-unit); - - .volume-title { - display: -webkit-box; - overflow: hidden; - height: 20px; - -webkit-box-orient: vertical; - -webkit-line-clamp: 1; - line-clamp: 1; - text-overflow: ellipsis; - } - - .isbn { - display: -webkit-box; - overflow: hidden; - height: 20px; - -webkit-box-orient: vertical; - -webkit-line-clamp: 1; - line-clamp: 1; - text-overflow: ellipsis; - } - - .tags { - display: flex; - overflow: hidden; - height: 22px; - flex-flow: wrap; - padding: calc(var(--space-unit) / 2) 0 var(--space-unit); - gap: var(--space-unit); - - z-tag.active { - --z-tag-bg: var(--color-primary03); - --z-tag-text-color: var(--color-default-text); - } - - z-tag.disabled { - --z-tag-bg: var(--color-surface03); - --z-tag-text-color: var(--color-default-text); - } - - z-tag.interactive { - cursor: pointer; - } - - z-tag:focus { - box-shadow: var(--shadow-focus-primary); - outline: none; - } - } - } - - .link-section { - display: flex; - height: 24px; - align-items: center; - justify-content: space-between; - gap: var(--space-unit); - - .adoption-tag { - padding: calc(var(--space-unit) / 2) var(--space-unit); - background-color: var(--green100); - border-radius: 100px; - text-transform: uppercase; - } - } - } - } - - .ebook-container { - height: 64px; - - .ebook { - display: flex; - align-items: center; - justify-content: space-between; - padding: calc(var(--space-unit) * 2) var(--space-unit); - background-color: var(--color-primary02); - border-radius: var(--border-radius); - gap: var(--space-unit); - - .app-name { - display: flex; - align-items: center; - padding: calc(var(--space-unit) / 2) 0; - font-family: var(--font-family-serif); - gap: calc(var(--space-unit) / 2); - - .laz { - color: var(--red500); - } - } - } - } - } - } - - ::slotted([slot="cta"]) { - grid-area: cta; - } - - ::slotted([slot="apps"]) { - border-top: solid var(--border-size-small) var(--color-surface03); - } +:host > article .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section .tags z-tag:focus { + box-shadow: var(--shadow-focus-primary); + outline: none; +} + +:host > article .main-content .card-info .book-data .isbn-tags-link-section .link-section { + display: flex; + height: 24px; + align-items: center; + justify-content: space-between; + gap: var(--space-unit); +} + +:host > article .main-content .card-info .book-data .isbn-tags-link-section .link-section .adoption-tag { + padding: calc(var(--space-unit) / 2) var(--space-unit); + background-color: var(--green100); + border-radius: 100px; + text-transform: uppercase; +} + +:host > article .main-content .card-info .ebook-container { + height: 64px; +} + +:host > article .main-content .card-info .ebook-container .ebook { + display: flex; + align-items: center; + justify-content: space-between; + padding: calc(var(--space-unit) * 2) var(--space-unit); + background-color: var(--color-primary02); + border-radius: var(--border-radius); + gap: var(--space-unit); +} + +:host > article .main-content .card-info .ebook-container .ebook .app-name { + display: flex; + align-items: center; + padding: calc(var(--space-unit) / 2) 0; + font-family: var(--font-family-serif); + gap: calc(var(--space-unit) / 2); +} + +:host > article .main-content .card-info .ebook-container .ebook .app-name .laz { + color: var(--red500); +} + +::slotted([slot="cta"]) { + grid-area: cta; +} + +::slotted([slot="apps"]) { + border-top: solid var(--border-size-small) var(--color-surface03); } :host > article.landscape { @@ -196,52 +194,48 @@ min-height: 332px; max-height: 428px; padding: 0; +} + +:host > article.landscape .main-content { + height: 296px; + flex-direction: row; + padding: calc(var(--space-unit) * 2); +} + +:host > article.landscape .main-content .cover { + display: flex; + overflow: hidden; + width: 221px; + height: auto; + margin: 0; +} + +:host > article.landscape .main-content .card-info { + margin: 0; +} + +:host > article.landscape .main-content .card-info .book-data { + gap: unset; +} + +:host > article.landscape .main-content .card-info .book-data .authors-title-cta-section { + grid-template-areas: + "authors cta" + "title title"; +} + +:host > article.landscape .main-content .card-info .book-data .authors-title-cta-section .authors { + margin-bottom: var(--space-unit); +} + +:host > article.landscape .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section .tags { + padding: calc(var(--space-unit) / 2) 0; +} + +:host > article.landscape .main-content .card-info .ebook-container { + height: 76px; +} - .main-content { - height: 296px; - flex-direction: row; - padding: calc(var(--space-unit) * 2); - - .cover { - display: flex; - overflow: hidden; - width: 221px; - height: auto; - margin: 0; - } - - .card-info { - margin: 0; - - .book-data { - gap: unset; - - .authors-title-cta-section { - grid-template-areas: - "authors cta" - "title title"; - - .authors { - margin-bottom: var(--space-unit); - } - } - - .isbn-tags-link-section { - .isbn-tags-section { - .tags { - padding: calc(var(--space-unit) / 2) 0; - } - } - } - } - - .ebook-container { - height: 76px; - - .ebook { - padding: var(--space-unit); - } - } - } - } +:host > article.landscape .main-content .card-info .ebook-container .ebook { + padding: var(--space-unit); } From f5c44b13f2d3cee4fea1ad84ad307b01f4b4419a Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Thu, 28 Nov 2024 15:51:37 +0100 Subject: [PATCH 05/26] feat!: add svg as css --- .../book-card/z-book-card/index.tsx | 51 ++----------------- .../book-card/z-book-card/styles.css | 8 +-- 2 files changed, 7 insertions(+), 52 deletions(-) diff --git a/src/components/book-card/z-book-card/index.tsx b/src/components/book-card/z-book-card/index.tsx index b40480513..98e089699 100644 --- a/src/components/book-card/z-book-card/index.tsx +++ b/src/components/book-card/z-book-card/index.tsx @@ -212,55 +212,10 @@ export class ZBookCard { private renderLaZEbookLogo(): SVGElement { return ( - + /> ); } diff --git a/src/components/book-card/z-book-card/styles.css b/src/components/book-card/z-book-card/styles.css index 080156dd0..2f31bbe64 100755 --- a/src/components/book-card/z-book-card/styles.css +++ b/src/components/book-card/z-book-card/styles.css @@ -177,6 +177,10 @@ gap: calc(var(--space-unit) / 2); } +:host > article .main-content .card-info .ebook-container .ebook .app-name .ebook-logo { + content: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2220%22 height=%2220%22 viewBox=%220 0 20 20%22 fill=%22none%22 aria-hidden=%22true%22%3E%3Cg clip-path=%22url(%23clip0_11996_224)%22%3E%3Cpath d=%22M14.6644 0.469604H5.00141C2.33305 0.469604 0.169922 2.63274 0.169922 5.3011V14.9641C0.169922 17.6324 2.33305 19.7956 5.00141 19.7956H14.6644C17.3328 19.7956 19.4959 17.6324 19.4959 14.9641V5.3011C19.4959 2.63274 17.3328 0.469604 14.6644 0.469604Z%22 fill=%22%23E2011A%22/%3E%3Cpath d=%22M15.9523 13.3536H12.7313C11.6861 13.3536 10.6683 13.6934 9.83241 14.3199C8.99657 13.6934 7.97873 13.3536 6.93352 13.3536H3.71252V5.30115H6.93352C7.97873 5.30115 8.99657 5.64096 9.83241 6.26745C10.6683 5.64096 11.6861 5.30115 12.7313 5.30115H15.9523V13.3536Z%22 fill=%22white%22/%3E%3Cpath d=%22M15.9523 14.3201H3.71252V14.9643H15.9523V14.3201Z%22 fill=%22black%22/%3E%3Cpath d=%22M8.22229 10.732V8.24543C8.22229 7.97165 8.51057 7.79449 8.75375 7.91689L11.2404 9.16019C11.5109 9.29548 11.5109 9.682 11.2404 9.81728L8.75375 11.0606C8.50896 11.183 8.22229 11.0058 8.22229 10.732Z%22 fill=%22black%22/%3E%3Cpath d=%22M4.35704 7.87826C5.42438 7.87826 6.28963 7.013 6.28963 5.94566C6.28963 4.87831 5.42438 4.01306 4.35704 4.01306C3.28969 4.01306 2.42444 4.87831 2.42444 5.94566C2.42444 7.013 3.28969 7.87826 4.35704 7.87826Z%22 fill=%22black%22/%3E%3Cpath d=%22M5.6454 5.62354H3.0686V6.26773H5.6454V5.62354Z%22 fill=%22white%22/%3E%3Cpath d=%22M4.67917 4.65723H4.03497V7.23402H4.67917V4.65723Z%22 fill=%22white%22/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id=%22clip0_11996_224%22%3E%3Crect width=%2219.326%22 height=%2219.326%22 fill=%22white%22 transform=%22translate(0.169922 0.469604)%22/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E"); +} + :host > article .main-content .card-info .ebook-container .ebook .app-name .laz { color: var(--red500); } @@ -224,10 +228,6 @@ "title title"; } -:host > article.landscape .main-content .card-info .book-data .authors-title-cta-section .authors { - margin-bottom: var(--space-unit); -} - :host > article.landscape .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section .tags { padding: calc(var(--space-unit) / 2) 0; } From e9b685e1f4a0e173e75f83e602746d0b6a1a3273 Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Thu, 28 Nov 2024 15:56:19 +0100 Subject: [PATCH 06/26] feat!: add cursor pointer --- src/components/book-card/z-book-card/index.tsx | 1 + src/components/book-card/z-book-card/styles.css | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/components/book-card/z-book-card/index.tsx b/src/components/book-card/z-book-card/index.tsx index 98e089699..3b904dd04 100644 --- a/src/components/book-card/z-book-card/index.tsx +++ b/src/components/book-card/z-book-card/index.tsx @@ -3,6 +3,7 @@ import {BookCardTag, BookCardTagEvent, BookCardTagStatus, BookCardVariant, Contr /** * @slot cta - to the right of authors and title (e.g. bookmark icon) + * @slot ebook - main action slot on the card (as default, it shows laZ ebook link) * @slot apps - list of card-related apps */ @Component({ diff --git a/src/components/book-card/z-book-card/styles.css b/src/components/book-card/z-book-card/styles.css index 2f31bbe64..9806eb5f6 100755 --- a/src/components/book-card/z-book-card/styles.css +++ b/src/components/book-card/z-book-card/styles.css @@ -185,6 +185,10 @@ color: var(--red500); } +:host > article .main-content .card-info .ebook-container .ebook .immersive-reader { + cursor: pointer; +} + ::slotted([slot="cta"]) { grid-area: cta; } From 20ce5d26f1698bc5e1557250f424f164420a55b9 Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Thu, 28 Nov 2024 16:42:45 +0100 Subject: [PATCH 07/26] feat!: add clickable app-name area --- .../book-card/z-book-card-app/index.tsx | 7 +- .../book-card/z-book-card-app/styles.css | 81 ++++++++++--------- .../book-card/z-book-card/index.tsx | 2 +- 3 files changed, 51 insertions(+), 39 deletions(-) diff --git a/src/components/book-card/z-book-card-app/index.tsx b/src/components/book-card/z-book-card-app/index.tsx index 276207ff6..4fd3ef87c 100644 --- a/src/components/book-card/z-book-card-app/index.tsx +++ b/src/components/book-card/z-book-card-app/index.tsx @@ -50,7 +50,10 @@ export class ZBookCardApp { render(): HTMLZBookCardAppElement { return (
- + {this.info && ( div .app { + display: flex; + flex: 1; + align-items: center; + gap: var(--space-unit); +} + +:host > div .app.z-link { + color: inherit; + text-decoration: none; +} + +:host > div .app.z-link:focus { + text-decoration: none; +} + +:host > div .app img { + width: 24px; + height: 24px; +} + +:host > div .app .name { + display: -webkit-box; + overflow: hidden; + height: 20px; + -webkit-box-orient: vertical; + font-family: var(--font-family-serif); + -webkit-line-clamp: 1; + line-clamp: 1; + text-overflow: ellipsis; +} + +:host > div .app .name .laz { + color: var(--red500); +} + +:host > div z-info-reveal { + --z-info-reveal-panel-width: 250px; + + font-family: var(--font-family-sans); - .app { - display: flex; - flex: 1; - align-items: center; - gap: var(--space-unit); - - img { - width: 24px; - height: 24px; - } - - .name { - display: -webkit-box; - overflow: hidden; - height: 20px; - -webkit-box-orient: vertical; - font-family: var(--font-family-serif); - -webkit-line-clamp: 1; - line-clamp: 1; - text-overflow: ellipsis; - - .laz { - color: var(--red500); - } - } - } - - z-info-reveal { - --z-info-reveal-panel-width: 250px; - - font-family: var(--font-family-sans); - - --color-surface05: var(--color-surface01); - --color-text-inverse: var(--color-default-text); - --color-inverse-icon: var(--color-primary01); - } + --color-surface05: var(--color-surface01); + --color-text-inverse: var(--color-default-text); + --color-inverse-icon: var(--color-primary01); } diff --git a/src/components/book-card/z-book-card/index.tsx b/src/components/book-card/z-book-card/index.tsx index 3b904dd04..d8049e79d 100644 --- a/src/components/book-card/z-book-card/index.tsx +++ b/src/components/book-card/z-book-card/index.tsx @@ -211,7 +211,7 @@ export class ZBookCard { ); } - private renderLaZEbookLogo(): SVGElement { + private renderLaZEbookLogo(): HTMLImageElement { return ( Date: Fri, 29 Nov 2024 09:26:06 +0100 Subject: [PATCH 08/26] feat!: add `aria-label` for card-app --- src/components/book-card/z-book-card-app/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/book-card/z-book-card-app/index.tsx b/src/components/book-card/z-book-card-app/index.tsx index 4fd3ef87c..68d31a9d1 100644 --- a/src/components/book-card/z-book-card-app/index.tsx +++ b/src/components/book-card/z-book-card-app/index.tsx @@ -53,6 +53,7 @@ export class ZBookCardApp { Date: Fri, 29 Nov 2024 11:34:05 +0100 Subject: [PATCH 09/26] feat!: add optional card-app logo --- src/components.d.ts | 2 +- src/components/book-card/z-book-card-app/index.tsx | 12 +++++++----- src/components/book-card/z-book-card/readme.md | 9 +++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components.d.ts b/src/components.d.ts index 39129bd71..35d0a5ee1 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -329,7 +329,7 @@ export namespace Components { /** * App logo url */ - "logo": string; + "logo"?: string; /** * App name */ diff --git a/src/components/book-card/z-book-card-app/index.tsx b/src/components/book-card/z-book-card-app/index.tsx index 68d31a9d1..3bcf7cb17 100644 --- a/src/components/book-card/z-book-card-app/index.tsx +++ b/src/components/book-card/z-book-card-app/index.tsx @@ -13,7 +13,7 @@ export class ZBookCardApp { * App logo url */ @Prop() - logo: string; + logo?: string; /** * App name @@ -55,10 +55,12 @@ export class ZBookCardApp { href={this.link} aria-label={`vai a ${this.laz ? "laz" : ""} ${this.name}`} > - + {this.logo && ( + + )}
{this.renderLaz()} {this.name} diff --git a/src/components/book-card/z-book-card/readme.md b/src/components/book-card/z-book-card/readme.md index b35c3761d..8873e58f6 100644 --- a/src/components/book-card/z-book-card/readme.md +++ b/src/components/book-card/z-book-card/readme.md @@ -38,10 +38,11 @@ ## Slots -| Slot | Description | -| -------- | ------------------------------------------------------ | -| `"apps"` | list of card-related apps | -| `"cta"` | to the right of authors and title (e.g. bookmark icon) | +| Slot | Description | +| --------- | ------------------------------------------------------------------ | +| `"apps"` | list of card-related apps | +| `"cta"` | to the right of authors and title (e.g. bookmark icon) | +| `"ebook"` | main action slot on the card (as default, it shows laZ ebook link) | ## Dependencies From f81a8792a3de5ccf74aff72bda6b00545b6f09ec Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Fri, 29 Nov 2024 11:44:02 +0100 Subject: [PATCH 10/26] feat!: emit tag event when pressing Enter key --- src/components/book-card/z-book-card/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/book-card/z-book-card/index.tsx b/src/components/book-card/z-book-card/index.tsx index d8049e79d..607e496b1 100644 --- a/src/components/book-card/z-book-card/index.tsx +++ b/src/components/book-card/z-book-card/index.tsx @@ -167,6 +167,14 @@ export class ZBookCard { state: tag.status, }) } + onKeyUp={(e: KeyboardEvent) => + tag.interactive && + e.key === "Enter" && + this.emitTagClick({ + tag: id, + state: tag.status, + }) + } > {label} From 25dd59576fdea6fb22e2a6813ae33a33f0765849 Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Fri, 29 Nov 2024 12:00:28 +0100 Subject: [PATCH 11/26] feat!: emit event when clicking card-app link --- src/components.d.ts | 19 +++++++++++++++++++ .../book-card/z-book-card-app/index.tsx | 12 +++++++++++- .../book-card/z-book-card-app/readme.md | 7 +++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/components.d.ts b/src/components.d.ts index 35d0a5ee1..c0d81291c 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -2147,6 +2147,10 @@ export interface ZBookCardCustomEvent extends CustomEvent { detail: T; target: HTMLZBookCardElement; } +export interface ZBookCardAppCustomEvent extends CustomEvent { + detail: T; + target: HTMLZBookCardAppElement; +} export interface ZBookCardDeprecatedCustomEvent extends CustomEvent { detail: T; target: HTMLZBookCardDeprecatedElement; @@ -2480,7 +2484,18 @@ declare global { prototype: HTMLZBookCardElement; new (): HTMLZBookCardElement; }; + interface HTMLZBookCardAppElementEventMap { + "appClick": any; + } interface HTMLZBookCardAppElement extends Components.ZBookCardApp, HTMLStencilElement { + addEventListener(type: K, listener: (this: HTMLZBookCardAppElement, ev: ZBookCardAppCustomEvent) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: HTMLZBookCardAppElement, ev: ZBookCardAppCustomEvent) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } var HTMLZBookCardAppElement: { prototype: HTMLZBookCardAppElement; @@ -3893,6 +3908,10 @@ declare namespace LocalJSX { * App name */ "name"?: string; + /** + * click on app link + */ + "onAppClick"?: (event: ZBookCardAppCustomEvent) => void; } /** * @cssprop --z-book-card-ribbon-background-color - ribbon backgrund color diff --git a/src/components/book-card/z-book-card-app/index.tsx b/src/components/book-card/z-book-card-app/index.tsx index 3bcf7cb17..3c0234c5b 100644 --- a/src/components/book-card/z-book-card-app/index.tsx +++ b/src/components/book-card/z-book-card-app/index.tsx @@ -1,4 +1,4 @@ -import {Component, Element, Prop, h} from "@stencil/core"; +import {Component, Element, Event, EventEmitter, Prop, h} from "@stencil/core"; import {ControlSize, InfoRevealPosition} from "../../../beans"; @Component({ @@ -39,6 +39,14 @@ export class ZBookCardApp { @Prop() info?: string; + /** click on app link */ + @Event() + appClick: EventEmitter; + + private emitAppClick(): void { + this.appClick.emit(); + } + private renderLaz(): HTMLSpanElement | null { if (this.laz) { return laZ ; @@ -54,6 +62,7 @@ export class ZBookCardApp { class="app z-link" href={this.link} aria-label={`vai a ${this.laz ? "laz" : ""} ${this.name}`} + onClick={() => this.emitAppClick()} > {this.logo && ( this.emitAppClick()} > ` | + + ## Dependencies ### Depends on From bb4774b7cb9adcc40ba52384f5dcb1dd493129d5 Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Fri, 29 Nov 2024 12:27:36 +0100 Subject: [PATCH 12/26] feat!: add `target` to app link --- src/components/book-card/z-book-card-app/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/book-card/z-book-card-app/index.tsx b/src/components/book-card/z-book-card-app/index.tsx index 3c0234c5b..e76645d68 100644 --- a/src/components/book-card/z-book-card-app/index.tsx +++ b/src/components/book-card/z-book-card-app/index.tsx @@ -63,6 +63,7 @@ export class ZBookCardApp { href={this.link} aria-label={`vai a ${this.laz ? "laz" : ""} ${this.name}`} onClick={() => this.emitAppClick()} + target="_blank" > {this.logo && ( this.emitAppClick()} + target="_blank" > Date: Fri, 29 Nov 2024 12:39:52 +0100 Subject: [PATCH 13/26] feat!: remove apps slot border --- src/components/book-card/z-book-card/styles.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/book-card/z-book-card/styles.css b/src/components/book-card/z-book-card/styles.css index 9806eb5f6..e3111277c 100755 --- a/src/components/book-card/z-book-card/styles.css +++ b/src/components/book-card/z-book-card/styles.css @@ -193,10 +193,6 @@ grid-area: cta; } -::slotted([slot="apps"]) { - border-top: solid var(--border-size-small) var(--color-surface03); -} - :host > article.landscape { width: 635px; min-height: 332px; From fde0954dad03d4a83d7b8997b2b627c4b08b78dc Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Fri, 29 Nov 2024 12:58:00 +0100 Subject: [PATCH 14/26] feat!: update ebook section background --- src/components/book-card/z-book-card/styles.css | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/book-card/z-book-card/styles.css b/src/components/book-card/z-book-card/styles.css index e3111277c..798d3c59a 100755 --- a/src/components/book-card/z-book-card/styles.css +++ b/src/components/book-card/z-book-card/styles.css @@ -40,7 +40,6 @@ flex: 1; flex-direction: column; justify-content: space-between; - margin: 0 var(--space-unit); gap: calc(var(--space-unit) * 2); } @@ -49,6 +48,7 @@ flex: 1; flex-direction: column; justify-content: space-between; + margin: 0 var(--space-unit); gap: var(--space-unit); } @@ -214,11 +214,8 @@ margin: 0; } -:host > article.landscape .main-content .card-info { - margin: 0; -} - :host > article.landscape .main-content .card-info .book-data { + margin: 0; gap: unset; } From b159373ae381fcea5e2497b9d0a238666c7f2f3e Mon Sep 17 00:00:00 2001 From: Valentina Pasquino Date: Mon, 2 Dec 2024 10:21:52 +0100 Subject: [PATCH 15/26] feat!: book-cards.html --- src/pages/book-cards.html | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/src/pages/book-cards.html b/src/pages/book-cards.html index b5afe9916..2c3c213ce 100644 --- a/src/pages/book-cards.html +++ b/src/pages/book-cards.html @@ -101,6 +101,81 @@

Landscape Variant

+

Portrait Variant

+
+ +
+ + + + +
+
+ + + + + +
EBOOK SLOT
+
+
+

App

Date: Mon, 2 Dec 2024 12:42:26 +0100 Subject: [PATCH 16/26] feat!: fix z-index for info-reveal panel --- src/components/z-info-reveal/styles.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/z-info-reveal/styles.css b/src/components/z-info-reveal/styles.css index 01553835b..9e934d17f 100644 --- a/src/components/z-info-reveal/styles.css +++ b/src/components/z-info-reveal/styles.css @@ -75,6 +75,7 @@ button:focus:focus-visible { .z-info-reveal-panel { position: absolute; + z-index: 99; display: flex; width: var(--z-info-reveal-panel-width); height: fit-content; From 5c4ba4a1dade4b2856ccc2bb18994cca2b18924b Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Mon, 2 Dec 2024 16:15:36 +0100 Subject: [PATCH 17/26] feat!: fix "immersive reading" accessibility --- src/components/book-card/z-book-card/index.tsx | 7 ++++--- src/components/book-card/z-book-card/styles.css | 4 ---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/components/book-card/z-book-card/index.tsx b/src/components/book-card/z-book-card/index.tsx index 607e496b1..3f41d6a88 100644 --- a/src/components/book-card/z-book-card/index.tsx +++ b/src/components/book-card/z-book-card/index.tsx @@ -296,12 +296,13 @@ export class ZBookCard { {this.variant === BookCardVariant.LANDSCAPE && (
Anche nella versione libro liquido con{" "} - this.emitImmersiveReaderClick()} + tabIndex={0} > strumento di lettura immersiva - +
)}
diff --git a/src/components/book-card/z-book-card/styles.css b/src/components/book-card/z-book-card/styles.css index 798d3c59a..02474c0d1 100755 --- a/src/components/book-card/z-book-card/styles.css +++ b/src/components/book-card/z-book-card/styles.css @@ -185,10 +185,6 @@ color: var(--red500); } -:host > article .main-content .card-info .ebook-container .ebook .immersive-reader { - cursor: pointer; -} - ::slotted([slot="cta"]) { grid-area: cta; } From 730720b21d1b6e302cf5014fd51af287e2f38dd8 Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Mon, 2 Dec 2024 16:18:07 +0100 Subject: [PATCH 18/26] feat!: remove renderLaZEbookLogo method --- src/components/book-card/z-book-card/index.tsx | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/components/book-card/z-book-card/index.tsx b/src/components/book-card/z-book-card/index.tsx index 3f41d6a88..083c2c847 100644 --- a/src/components/book-card/z-book-card/index.tsx +++ b/src/components/book-card/z-book-card/index.tsx @@ -219,15 +219,6 @@ export class ZBookCard { ); } - private renderLaZEbookLogo(): HTMLImageElement { - return ( - - ); - } - render(): HTMLZBookCardElement { return (
this.emitCatalogClick()} > Scheda catalogo @@ -288,7 +279,10 @@ export class ZBookCard {
- {this.renderLaZEbookLogo()} +
laZ Ebook
From ddc9450d76622ad352db12d0a9227e142f0f1c3e Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Tue, 3 Dec 2024 10:53:07 +0100 Subject: [PATCH 19/26] feat!: fix portrait `column-gap` --- src/components/book-card/z-book-card/styles.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/book-card/z-book-card/styles.css b/src/components/book-card/z-book-card/styles.css index 02474c0d1..c9ce077f9 100755 --- a/src/components/book-card/z-book-card/styles.css +++ b/src/components/book-card/z-book-card/styles.css @@ -54,7 +54,7 @@ :host > article .main-content .card-info .book-data .authors-title-cta-section { display: grid; - column-gap: calc(var(--space-unit) * 2); + column-gap: var(--space-unit); grid-template-areas: "authors authors" "title cta"; @@ -216,6 +216,7 @@ } :host > article.landscape .main-content .card-info .book-data .authors-title-cta-section { + column-gap: calc(var(--space-unit) * 2); grid-template-areas: "authors cta" "title title"; From 2d3029ab36050b44396070dee3d111e8f38a0690 Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Tue, 3 Dec 2024 11:10:36 +0100 Subject: [PATCH 20/26] feat!: add migration guide --- MIGRATION.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/MIGRATION.md b/MIGRATION.md index 50a65c8c2..ce4609044 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -9,6 +9,10 @@ Ogni volta che viene implementato un **breaking change** su un componente, la su Indice delle breaking changes divise per numero di versione in cui sono state introdotte. +- [v17.0.0](#v1700) + + - [Refactor componente `z-book-card`](#refactor-componente-zbookcard) + - [v16.0.0](#v1600) - [Nuova versione componente ZAppHeader](#nuova-versione-componente-zappheader) @@ -105,6 +109,27 @@ Indice delle breaking changes divise per numero di versione in cui sono state in - [ZButtonFilter (deprecato)](#zbuttonfilter-deprecato) - [ZChip (rifattorizzato)](#zchip-rifattorizzato) +## v17.0.0 + +### Refactor componente `ZBookCard` + +La versione attuale del componente è stata mantenuta con il nuovo nome `z-book-card-deprecated`. +La nuova versione è disponibile in due varianti, `landscape` e `portrait`, che sono i valori da passare alla prop `variant`. +Le prop `ribbon`, `ribbonIcon`, `ribbonInteractive`, `borderless` sono state eliminate. +La prop `operaTitleTag` cambia nome in `operaTitleHtmlTag`. +Sono state aggiunte le prop `edi`, `annotated`, `teacherVersion` per gestire i tag: accettano un oggetto di questo tipo + +``` +{ + status: "active"|"disabled"; + interactive: boolean; +} +``` + +Dove `status` definisce lo stile del tag, mentre `interactive` gestisce il click dell'utente. +È stata aggiunta la prop `adoption` che gestisce il badge dei libri adottati. +Le nuove prop `catalogUrl` e `ebookUrl` gestiscono rispettivamente i link al catalogo Zanichelli e al libro digitale. + ## v16.0.0 ### Nuova versione componente ZAppHeader From 38cca870ce1bb9c877064aa4bc3c56e763966256 Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Tue, 3 Dec 2024 11:53:46 +0100 Subject: [PATCH 21/26] feat!: fix tags box-shadow visibility --- src/components/book-card/z-book-card/styles.css | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/book-card/z-book-card/styles.css b/src/components/book-card/z-book-card/styles.css index c9ce077f9..eb0d51054 100755 --- a/src/components/book-card/z-book-card/styles.css +++ b/src/components/book-card/z-book-card/styles.css @@ -117,7 +117,9 @@ overflow: hidden; height: 22px; flex-flow: wrap; - padding: calc(var(--space-unit) / 2) 0 var(--space-unit); + align-items: center; + padding: var(--space-unit); + margin: calc(calc(var(--space-unit) / 2) * -1) calc(var(--space-unit) * -1) 0; gap: var(--space-unit); } @@ -223,7 +225,7 @@ } :host > article.landscape .main-content .card-info .book-data .isbn-tags-link-section .isbn-tags-section .tags { - padding: calc(var(--space-unit) / 2) 0; + margin: calc(calc(var(--space-unit) / 2) * -1) calc(var(--space-unit) * -1); } :host > article.landscape .main-content .card-info .ebook-container { From 7ba1ef54d63d2de93628cd449143209d2fbd88e5 Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Tue, 3 Dec 2024 14:09:45 +0100 Subject: [PATCH 22/26] feat!: fix Storybook book-card with apps --- src/components/book-card/z-book-card/index.stories.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/book-card/z-book-card/index.stories.ts b/src/components/book-card/z-book-card/index.stories.ts index 73aa9d703..22699c81f 100644 --- a/src/components/book-card/z-book-card/index.stories.ts +++ b/src/components/book-card/z-book-card/index.stories.ts @@ -127,7 +127,7 @@ export const WithSlottedContent = {
Date: Tue, 3 Dec 2024 15:50:50 +0100 Subject: [PATCH 23/26] feat!: fix host border-radius --- src/components/book-card/z-book-card/styles.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/book-card/z-book-card/styles.css b/src/components/book-card/z-book-card/styles.css index eb0d51054..363bcb67a 100755 --- a/src/components/book-card/z-book-card/styles.css +++ b/src/components/book-card/z-book-card/styles.css @@ -1,6 +1,7 @@ :host { display: block; max-width: fit-content; + border-radius: var(--border-radius); } :host > article { From fe12e549c77cf074be0a6131531d7f87a6cae8af Mon Sep 17 00:00:00 2001 From: FrancescoSanti Date: Tue, 3 Dec 2024 17:00:48 +0100 Subject: [PATCH 24/26] feat!: add css props to change `z-book-card-app` padding --- src/components.d.ts | 20 +++++++++++++++++++ .../z-book-card-app/index.stories.ts | 18 +++++++++++++++-- .../book-card/z-book-card-app/index.tsx | 5 +++++ .../book-card/z-book-card-app/readme.md | 4 ++++ .../book-card/z-book-card-app/styles.css | 3 ++- .../book-card/z-book-card/index.stories.ts | 2 +- 6 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/components.d.ts b/src/components.d.ts index c0d81291c..9c8593012 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -313,6 +313,11 @@ export namespace Components { */ "volumeTitle"?: string; } + /** + * ZBookCardApp component + * @cssprop --z-book-card-app-padding-x - set left and right padding + * @cssprop --z-book-card-app-padding-y - set top and bottom padding + */ interface ZBookCardApp { /** * Info text to show as inforeveal @@ -2487,6 +2492,11 @@ declare global { interface HTMLZBookCardAppElementEventMap { "appClick": any; } + /** + * ZBookCardApp component + * @cssprop --z-book-card-app-padding-x - set left and right padding + * @cssprop --z-book-card-app-padding-y - set top and bottom padding + */ interface HTMLZBookCardAppElement extends Components.ZBookCardApp, HTMLStencilElement { addEventListener(type: K, listener: (this: HTMLZBookCardAppElement, ev: ZBookCardAppCustomEvent) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -3887,6 +3897,11 @@ declare namespace LocalJSX { */ "volumeTitle"?: string; } + /** + * ZBookCardApp component + * @cssprop --z-book-card-app-padding-x - set left and right padding + * @cssprop --z-book-card-app-padding-y - set top and bottom padding + */ interface ZBookCardApp { /** * Info text to show as inforeveal @@ -6068,6 +6083,11 @@ declare module "@stencil/core" { "z-aria-alert": LocalJSX.ZAriaAlert & JSXBase.HTMLAttributes; "z-avatar": LocalJSX.ZAvatar & JSXBase.HTMLAttributes; "z-book-card": LocalJSX.ZBookCard & JSXBase.HTMLAttributes; + /** + * ZBookCardApp component + * @cssprop --z-book-card-app-padding-x - set left and right padding + * @cssprop --z-book-card-app-padding-y - set top and bottom padding + */ "z-book-card-app": LocalJSX.ZBookCardApp & JSXBase.HTMLAttributes; /** * @cssprop --z-book-card-ribbon-background-color - ribbon backgrund color diff --git a/src/components/book-card/z-book-card-app/index.stories.ts b/src/components/book-card/z-book-card-app/index.stories.ts index cc980941b..a78227c0c 100644 --- a/src/components/book-card/z-book-card-app/index.stories.ts +++ b/src/components/book-card/z-book-card-app/index.stories.ts @@ -1,18 +1,24 @@ import {Meta, StoryObj} from "@storybook/web-components"; import {html} from "lit"; +import {styleMap} from "lit/directives/style-map.js"; import {ZBookCardApp} from "."; +import {CSSVarsArguments} from "../../../utils/storybook-utils"; import "../../z-button/index"; import "../../z-icon/index"; import "../../z-tag/index"; import "../z-book-card-app/index"; import "./index"; -type ZBookCardAppStoriesArgs = ZBookCardApp; +type ZBookCardAppStoriesArgs = ZBookCardApp & + CSSVarsArguments<"z-book-card-app-padding-x" | "z-book-card-app-padding-y">; const StoryMeta = { title: "ZBookCard/ZBookCardApp", component: "z-book-card-app", - argTypes: {}, + argTypes: { + "--z-book-card-app-padding-x": {control: {type: "text"}}, + "--z-book-card-app-padding-y": {control: {type: "text"}}, + }, args: { logo: "https://placehold.co/24", name: "Esercizi", @@ -27,6 +33,10 @@ export default StoryMeta; type Story = StoryObj; export const CardApp = { + args: { + "--z-book-card-app-padding-x": null, + "--z-book-card-app-padding-y": null, + }, render: (args) => html``, } satisfies Story; diff --git a/src/components/book-card/z-book-card-app/index.tsx b/src/components/book-card/z-book-card-app/index.tsx index e76645d68..d4b7f843e 100644 --- a/src/components/book-card/z-book-card-app/index.tsx +++ b/src/components/book-card/z-book-card-app/index.tsx @@ -1,6 +1,11 @@ import {Component, Element, Event, EventEmitter, Prop, h} from "@stencil/core"; import {ControlSize, InfoRevealPosition} from "../../../beans"; +/** + * ZBookCardApp component + * @cssprop --z-book-card-app-padding-x - set left and right padding + * @cssprop --z-book-card-app-padding-y - set top and bottom padding + */ @Component({ tag: "z-book-card-app", styleUrls: ["styles.css", "../../css-components/z-link/styles.css", "../../../tokens/typography.css"], diff --git a/src/components/book-card/z-book-card-app/readme.md b/src/components/book-card/z-book-card-app/readme.md index 3a09bf4ce..7ded5f158 100644 --- a/src/components/book-card/z-book-card-app/readme.md +++ b/src/components/book-card/z-book-card-app/readme.md @@ -5,6 +5,10 @@ +## Overview + +ZBookCardApp component + ## Properties | Property | Attribute | Description | Type | Default | diff --git a/src/components/book-card/z-book-card-app/styles.css b/src/components/book-card/z-book-card-app/styles.css index 028c25c12..c7f3312f1 100755 --- a/src/components/book-card/z-book-card-app/styles.css +++ b/src/components/book-card/z-book-card-app/styles.css @@ -14,7 +14,8 @@ box-sizing: border-box; align-items: center; justify-content: space-between; - padding: var(--space-unit) calc(var(--space-unit) * 1.5); + padding: var(--z-book-card-app-padding-y, calc(var(--space-unit) * 1.5)) + var(--z-book-card-app-padding-x, var(--space-unit)); gap: calc(var(--space-unit) * 2); } diff --git a/src/components/book-card/z-book-card/index.stories.ts b/src/components/book-card/z-book-card/index.stories.ts index 22699c81f..5a34bf106 100644 --- a/src/components/book-card/z-book-card/index.stories.ts +++ b/src/components/book-card/z-book-card/index.stories.ts @@ -127,7 +127,7 @@ export const WithSlottedContent = {
Date: Tue, 3 Dec 2024 17:38:33 +0100 Subject: [PATCH 25/26] feat!: book-cards.html --- .../book-card/z-book-card/index.stories.ts | 12 ++++++------ src/pages/book-cards.html | 16 +++++++++++----- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/components/book-card/z-book-card/index.stories.ts b/src/components/book-card/z-book-card/index.stories.ts index 5a34bf106..d9ea693e1 100644 --- a/src/components/book-card/z-book-card/index.stories.ts +++ b/src/components/book-card/z-book-card/index.stories.ts @@ -127,35 +127,35 @@ export const WithSlottedContent = {
`, diff --git a/src/pages/book-cards.html b/src/pages/book-cards.html index 2c3c213ce..d75bf9714 100644 --- a/src/pages/book-cards.html +++ b/src/pages/book-cards.html @@ -40,7 +40,7 @@

Landscape Variant

>
Landscape Variant info="test test" link="http://localhost" laz="false" - style="width: 315px; height: 47px; border-right: 1px solid #d6d6d6; border-bottom: 1px solid #d6d6d6" + style=" + width: 315px; + height: 47px; + border-right: 1px solid #d6d6d6; + border-bottom: 1px solid #d6d6d6; + --z-book-card-app-padding-x: 16px; + " >
From 8e764d7d7a0bb82b1beb23ef8a6aeeba72991a61 Mon Sep 17 00:00:00 2001 From: Valentina Pasquino Date: Thu, 5 Dec 2024 16:33:59 +0100 Subject: [PATCH 26/26] feat!: target blank --- src/components/book-card/z-book-card/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/book-card/z-book-card/index.tsx b/src/components/book-card/z-book-card/index.tsx index 083c2c847..7e7046f46 100644 --- a/src/components/book-card/z-book-card/index.tsx +++ b/src/components/book-card/z-book-card/index.tsx @@ -256,6 +256,7 @@ export class ZBookCard { {this.catalogUrl && (
this.emitCatalogClick()} > @@ -303,6 +304,7 @@ export class ZBookCard { this.emitEbookClick()} role="link" aria-description={`leggi l'ebook ${this.operaTitle} su laZ Ebook`}