Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/z book card portrait #493

Merged
merged 26 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d370166
feat!: wip tags
vpasquino Nov 25, 2024
56e40e9
feat!: tags, storybook, flexible app
vpasquino Nov 26, 2024
87adc2f
feat!: add portrait card
francesco-santi-1 Nov 28, 2024
f1fefe9
feat!: avoid css nesting to increase browsers compatibility
francesco-santi-1 Nov 28, 2024
f5c44b1
feat!: add svg as css
francesco-santi-1 Nov 28, 2024
e9b685e
feat!: add cursor pointer
francesco-santi-1 Nov 28, 2024
20ce5d2
feat!: add clickable app-name area
francesco-santi-1 Nov 28, 2024
91fa5ff
feat!: add `aria-label` for card-app
francesco-santi-1 Nov 29, 2024
8ec73e5
feat!: add optional card-app logo
francesco-santi-1 Nov 29, 2024
f81a879
feat!: emit tag event when pressing Enter key
francesco-santi-1 Nov 29, 2024
25dd595
feat!: emit event when clicking card-app link
francesco-santi-1 Nov 29, 2024
bb4774b
feat!: add `target` to app link
francesco-santi-1 Nov 29, 2024
9a9feca
feat!: remove apps slot border
francesco-santi-1 Nov 29, 2024
fde0954
feat!: update ebook section background
francesco-santi-1 Nov 29, 2024
b159373
feat!: book-cards.html
vpasquino Dec 2, 2024
decff6d
feat!: fix z-index for info-reveal panel
francesco-santi-1 Dec 2, 2024
5c4ba4a
feat!: fix "immersive reading" accessibility
francesco-santi-1 Dec 2, 2024
730720b
feat!: remove renderLaZEbookLogo method
francesco-santi-1 Dec 2, 2024
ddc9450
feat!: fix portrait `column-gap`
francesco-santi-1 Dec 3, 2024
2d3029a
feat!: add migration guide
francesco-santi-1 Dec 3, 2024
38cca87
feat!: fix tags box-shadow visibility
francesco-santi-1 Dec 3, 2024
7ba1ef5
feat!: fix Storybook book-card with apps
francesco-santi-1 Dec 3, 2024
ebd512d
feat!: fix host border-radius
francesco-santi-1 Dec 3, 2024
fe12e54
feat!: add css props to change `z-book-card-app` padding
francesco-santi-1 Dec 3, 2024
016a738
feat!: book-cards.html
vpasquino Dec 3, 2024
8e764d7
feat!: target blank
vpasquino Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/beans/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,17 @@ export enum BookCardDeprecatedVariant {
SEARCH = "search",
}

export enum CardTagStatus {
export type BookCardTag = {
status: BookCardTagStatus;
interactive: boolean;
};

export enum BookCardTagStatus {
ACTIVE = "active",
DISABLED = "disabled",
}

export type CardTagEvent = {
export type BookCardTagEvent = {
tag: string;
state: string;
};
Expand Down
46 changes: 35 additions & 11 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* It contains typing information for all components that exist in this project.
*/
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import { AccordionVariant, AvatarSize, BookCardDeprecatedVariant, BookCardVariant, BreadcrumbHomepageVariant, BreadcrumbPath, BreadcrumbPathStyle, ButtonSize, ButtonType, ButtonVariant, CardTagStatus, CardVariant, CarouselArrowsPosition, CarouselProgressMode, ComboItem, ControlSize, CoverHeroContentPosition, CoverHeroVariant, DictionaryData, DividerOrientation, DividerSize, ExpandableListButtonAlign, ExpandableListStyle, InfoRevealPosition, InputStatus, InputType, LabelPosition, ListDividerType, ListSize, ListType, NavigationTabsOrientation, NavigationTabsSize, NotificationType, OffCanvasVariant, PopoverPosition, SearchbarItem, SelectItem, SkipToContentLink, SortDirection, ThemeVariant, ToastNotification, ToastNotificationPosition, ToastNotificationTransition, TransitionDirection, VisibilityCondition, ZAriaAlertMode, ZChipType, ZDatePickerMode, ZFileUploadType, ZRangePickerMode, ZSectionTitleDividerPosition } from "./beans";
import { AccordionVariant, AvatarSize, BookCardDeprecatedVariant, BookCardTag, BookCardVariant, BreadcrumbHomepageVariant, BreadcrumbPath, BreadcrumbPathStyle, ButtonSize, ButtonType, ButtonVariant, CardVariant, CarouselArrowsPosition, CarouselProgressMode, ComboItem, ControlSize, CoverHeroContentPosition, CoverHeroVariant, DictionaryData, DividerOrientation, DividerSize, ExpandableListButtonAlign, ExpandableListStyle, InfoRevealPosition, InputStatus, InputType, LabelPosition, ListDividerType, ListSize, ListType, NavigationTabsOrientation, NavigationTabsSize, NotificationType, OffCanvasVariant, PopoverPosition, SearchbarItem, SelectItem, SkipToContentLink, SortDirection, ThemeVariant, ToastNotification, ToastNotificationPosition, ToastNotificationTransition, TransitionDirection, VisibilityCondition, ZAriaAlertMode, ZChipType, ZDatePickerMode, ZFileUploadType, ZRangePickerMode, ZSectionTitleDividerPosition } from "./beans";
import { AlertType, LicenseType } from "./beans/index";
import { ListItem } from "./beans/index.js";
export { AccordionVariant, AvatarSize, BookCardDeprecatedVariant, BookCardVariant, BreadcrumbHomepageVariant, BreadcrumbPath, BreadcrumbPathStyle, ButtonSize, ButtonType, ButtonVariant, CardTagStatus, CardVariant, CarouselArrowsPosition, CarouselProgressMode, ComboItem, ControlSize, CoverHeroContentPosition, CoverHeroVariant, DictionaryData, DividerOrientation, DividerSize, ExpandableListButtonAlign, ExpandableListStyle, InfoRevealPosition, InputStatus, InputType, LabelPosition, ListDividerType, ListSize, ListType, NavigationTabsOrientation, NavigationTabsSize, NotificationType, OffCanvasVariant, PopoverPosition, SearchbarItem, SelectItem, SkipToContentLink, SortDirection, ThemeVariant, ToastNotification, ToastNotificationPosition, ToastNotificationTransition, TransitionDirection, VisibilityCondition, ZAriaAlertMode, ZChipType, ZDatePickerMode, ZFileUploadType, ZRangePickerMode, ZSectionTitleDividerPosition } from "./beans";
export { AccordionVariant, AvatarSize, BookCardDeprecatedVariant, BookCardTag, BookCardVariant, BreadcrumbHomepageVariant, BreadcrumbPath, BreadcrumbPathStyle, ButtonSize, ButtonType, ButtonVariant, CardVariant, CarouselArrowsPosition, CarouselProgressMode, ComboItem, ControlSize, CoverHeroContentPosition, CoverHeroVariant, DictionaryData, DividerOrientation, DividerSize, ExpandableListButtonAlign, ExpandableListStyle, InfoRevealPosition, InputStatus, InputType, LabelPosition, ListDividerType, ListSize, ListType, NavigationTabsOrientation, NavigationTabsSize, NotificationType, OffCanvasVariant, PopoverPosition, SearchbarItem, SelectItem, SkipToContentLink, SortDirection, ThemeVariant, ToastNotification, ToastNotificationPosition, ToastNotificationTransition, TransitionDirection, VisibilityCondition, ZAriaAlertMode, ZChipType, ZDatePickerMode, ZFileUploadType, ZRangePickerMode, ZSectionTitleDividerPosition } from "./beans";
export { AlertType, LicenseType } from "./beans/index";
export { ListItem } from "./beans/index.js";
export namespace Components {
Expand Down Expand Up @@ -259,7 +259,7 @@ export namespace Components {
/**
* [optional] Annotated tag
*/
"annotated"?: CardTagStatus;
"annotated"?: BookCardTag | string;
/**
* [optional] Authors
*/
Expand All @@ -279,7 +279,7 @@ export namespace Components {
/**
* [optional] EDI tag
*/
"edi"?: CardTagStatus;
"edi"?: BookCardTag | string;
/**
* [optional] Fallback cover URL
*/
Expand All @@ -301,9 +301,9 @@ export namespace Components {
*/
"operaTitleHtmlTag"?: string;
/**
* [optional] Annotated tag
* [optional] Teacher version tag
*/
"teacherVersion"?: CardTagStatus;
"teacherVersion"?: BookCardTag | string;
/**
* Card variant: landscape, portrait
*/
Expand All @@ -329,7 +329,7 @@ export namespace Components {
/**
* App logo url
*/
"logo": string;
"logo"?: string;
/**
* App name
*/
Expand Down Expand Up @@ -2147,6 +2147,10 @@ export interface ZBookCardCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLZBookCardElement;
}
export interface ZBookCardAppCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLZBookCardAppElement;
}
export interface ZBookCardDeprecatedCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLZBookCardDeprecatedElement;
Expand Down Expand Up @@ -2464,6 +2468,7 @@ declare global {
"tagClick": any;
"catalogClick": any;
"ebookClick": any;
"immersiveReaderClick": any;
}
interface HTMLZBookCardElement extends Components.ZBookCard, HTMLStencilElement {
addEventListener<K extends keyof HTMLZBookCardElementEventMap>(type: K, listener: (this: HTMLZBookCardElement, ev: ZBookCardCustomEvent<HTMLZBookCardElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
Expand All @@ -2479,7 +2484,18 @@ declare global {
prototype: HTMLZBookCardElement;
new (): HTMLZBookCardElement;
};
interface HTMLZBookCardAppElementEventMap {
"appClick": any;
}
interface HTMLZBookCardAppElement extends Components.ZBookCardApp, HTMLStencilElement {
addEventListener<K extends keyof HTMLZBookCardAppElementEventMap>(type: K, listener: (this: HTMLZBookCardAppElement, ev: ZBookCardAppCustomEvent<HTMLZBookCardAppElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof HTMLZBookCardAppElementEventMap>(type: K, listener: (this: HTMLZBookCardAppElement, ev: ZBookCardAppCustomEvent<HTMLZBookCardAppElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener<K extends keyof HTMLElementEventMap>(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;
Expand Down Expand Up @@ -3801,7 +3817,7 @@ declare namespace LocalJSX {
/**
* [optional] Annotated tag
*/
"annotated"?: CardTagStatus;
"annotated"?: BookCardTag | string;
/**
* [optional] Authors
*/
Expand All @@ -3821,7 +3837,7 @@ declare namespace LocalJSX {
/**
* [optional] EDI tag
*/
"edi"?: CardTagStatus;
"edi"?: BookCardTag | string;
/**
* [optional] Fallback cover URL
*/
Expand All @@ -3842,6 +3858,10 @@ declare namespace LocalJSX {
* click on ebook link
*/
"onEbookClick"?: (event: ZBookCardCustomEvent<any>) => void;
/**
* click on immersive reader
*/
"onImmersiveReaderClick"?: (event: ZBookCardCustomEvent<any>) => void;
/**
* click on tag
*/
Expand All @@ -3855,9 +3875,9 @@ declare namespace LocalJSX {
*/
"operaTitleHtmlTag"?: string;
/**
* [optional] Annotated tag
* [optional] Teacher version tag
*/
"teacherVersion"?: CardTagStatus;
"teacherVersion"?: BookCardTag | string;
/**
* Card variant: landscape, portrait
*/
Expand Down Expand Up @@ -3888,6 +3908,10 @@ declare namespace LocalJSX {
* App name
*/
"name"?: string;
/**
* click on app link
*/
"onAppClick"?: (event: ZBookCardAppCustomEvent<any>) => void;
}
/**
* @cssprop --z-book-card-ribbon-background-color - ribbon backgrund color
Expand Down
2 changes: 1 addition & 1 deletion src/components/book-card/z-book-card-app/index.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "./index";
type ZBookCardAppStoriesArgs = ZBookCardApp;

const StoryMeta = {
title: "ZBookCardApp",
title: "ZBookCard/ZBookCardApp",
component: "z-book-card-app",
argTypes: {},
args: {
Expand Down
35 changes: 27 additions & 8 deletions src/components/book-card/z-book-card-app/index.tsx
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -13,7 +13,7 @@ export class ZBookCardApp {
* App logo url
*/
@Prop()
logo: string;
logo?: string;

/**
* App name
Expand All @@ -39,6 +39,14 @@ export class ZBookCardApp {
@Prop()
info?: string;
AliGamb marked this conversation as resolved.
Show resolved Hide resolved

/** click on app link */
@Event()
appClick: EventEmitter;

private emitAppClick(): void {
this.appClick.emit();
AliGamb marked this conversation as resolved.
Show resolved Hide resolved
}

private renderLaz(): HTMLSpanElement | null {
if (this.laz) {
return <span class="laz">laZ </span>;
Expand All @@ -50,16 +58,24 @@ export class ZBookCardApp {
render(): HTMLZBookCardAppElement {
return (
<div>
<div class="app">
<img
src={this.logo}
alt=""
/>
<a
class="app z-link"
href={this.link}
aria-label={`vai a ${this.laz ? "laz" : ""} ${this.name}`}
onClick={() => this.emitAppClick()}
target="_blank"
>
{this.logo && (
<img
src={this.logo}
alt=""
/>
)}
<div class="name body-4-sb">
{this.renderLaz()}
{this.name}
</div>
</div>
</a>
{this.info && (
<z-info-reveal
icon="info"
Expand All @@ -73,6 +89,9 @@ export class ZBookCardApp {
<a
class="z-link z-link-icon"
href={this.link}
aria-label={`vai a ${this.laz ? "laz" : ""} ${this.name}`}
onClick={() => this.emitAppClick()}
target="_blank"
>
<z-icon
name="chevron-right"
Expand Down
7 changes: 7 additions & 0 deletions src/components/book-card/z-book-card-app/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
| `name` | `name` | App name | `string` | `undefined` |


## Events

| Event | Description | Type |
| ---------- | ----------------- | ------------------ |
| `appClick` | click on app link | `CustomEvent<any>` |


## Dependencies

### Depends on
Expand Down
94 changes: 56 additions & 38 deletions src/components/book-card/z-book-card-app/styles.css
Original file line number Diff line number Diff line change
@@ -1,47 +1,65 @@
:host {
display: block;
width: inherit;
min-width: 300px;
height: inherit;
min-height: 32px;
background-color: var(--color-surface01);
}

:host > div {
display: flex;
width: 315px;
height: 47px;
width: 100%;
height: 100%;
AliGamb marked this conversation as resolved.
Show resolved Hide resolved
box-sizing: border-box;
align-items: center;
justify-content: space-between;
padding: var(--space-unit) calc(var(--space-unit) * 1.5);
gap: calc(var(--space-unit) * 2);
}

:host > 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);
}
Loading