Skip to content

Commit

Permalink
feat(core/blind): add sublabel property (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuke-ellington committed Sep 6, 2023
1 parent 2e048fd commit 6c8c665
Show file tree
Hide file tree
Showing 14 changed files with 112 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-example',
template: `
<ix-blind label="Example" icon="info">
<ix-blind label="Example" icon="info" sublabel="Sublabel">
<ix-icon-button
id="context-menu"
slot="header-actions"
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ export declare interface IxBasicNavigation extends Components.IxBasicNavigation


@ProxyCmp({
inputs: ['collapsed', 'icon', 'label']
inputs: ['collapsed', 'icon', 'label', 'sublabel']
})
@Component({
selector: 'ix-blind',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: ['collapsed', 'icon', 'label'],
inputs: ['collapsed', 'icon', 'label', 'sublabel'],
})
export class IxBlind {
protected el: HTMLElement;
Expand Down
31 changes: 29 additions & 2 deletions packages/core/component-doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,13 @@
"encapsulation": "shadow",
"dependents": [],
"dependencies": [
"ix-icon"
"ix-icon",
"ix-typography"
],
"dependencyGraph": {
"ix-blind": [
"ix-icon"
"ix-icon",
"ix-typography"
]
},
"props": [
Expand Down Expand Up @@ -488,6 +490,27 @@
],
"optional": false,
"required": false
},
{
"name": "sublabel",
"type": "string",
"mutable": false,
"attr": "sublabel",
"reflectToAttr": false,
"docs": "Secondary label inside blind header",
"docsTags": [
{
"name": "since",
"text": "2.0.0"
}
],
"values": [
{
"type": "string"
}
],
"optional": false,
"required": false
}
],
"methods": [],
Expand Down Expand Up @@ -11412,6 +11435,7 @@
"encapsulation": "shadow",
"dependents": [
"ix-action-card",
"ix-blind",
"ix-card-list",
"ix-content-header",
"ix-dropdown-header",
Expand All @@ -11429,6 +11453,9 @@
"ix-action-card": [
"ix-typography"
],
"ix-blind": [
"ix-typography"
],
"ix-card-list": [
"ix-typography"
],
Expand Down
10 changes: 10 additions & 0 deletions packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ export namespace Components {
* Label of blind
*/
"label": string;
/**
* Secondary label inside blind header
* @since 2.0.0
*/
"sublabel": string;
}
interface IxBreadcrumb {
/**
Expand Down Expand Up @@ -3144,6 +3149,11 @@ declare namespace LocalJSX {
* Collapsed state changed
*/
"onCollapsedChange"?: (event: IxBlindCustomEvent<boolean>) => void;
/**
* Secondary label inside blind header
* @since 2.0.0
*/
"sublabel"?: string;
}
interface IxBreadcrumb {
/**
Expand Down
15 changes: 15 additions & 0 deletions packages/core/src/components/blind/blind.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@
padding: $tiny-space $small-space;
}

ix-typography,
.blind-header-title-label,
.blind-header-title-sublabel {
@include ellipsis;
flex-grow: 1;
}

.blind-header-title-label {
padding-inline-end: 0.5rem;
}

.blind-header-title-sublabel {
padding-inline: 0.5rem;
}

.blind-header-title,
.blind-header-title-basic {
@include ellipsis;
Expand Down
24 changes: 23 additions & 1 deletion packages/core/src/components/blind/blind.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export class Blind {
*/
@Prop() label: string;

/**
* Secondary label inside blind header
* @since 2.0.0
*/
@Prop() sublabel: string;

/**
* Optional icon to be displayed next to the header label
* @since 1.5.0
Expand Down Expand Up @@ -148,7 +154,23 @@ export class Blind {
) : (
''
)}
<span class="blind-header-title-default">{this.label}</span>
<ix-typography format="label-lg" bold>
<div class="blind-header-title-label" title={this.label}>
{this.label}
</div>
</ix-typography>
{this.sublabel !== undefined ? (
<ix-typography color="soft">
<div
class="blind-header-title-sublabel"
title={this.sublabel}
>
{this.sublabel}
</div>
</ix-typography>
) : (
''
)}
<span
class="header-actions"
onClick={(e) => e.stopImmediatePropagation()}
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/tests/blind/blind.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ regressionTest.describe('blind', () => {
expect(await blind.screenshot()).toMatchSnapshot();
});

regressionTest('sublabel', async ({ page }) => {
await page.goto('blind/sublabel');
const blind = await page.waitForSelector('ix-blind');
expect(await blind.screenshot()).toMatchSnapshot();
});

regressionTest('collapsed', async ({ page }) => {
await page.goto('blind/basic');
await page.locator('.blind-header').click();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions packages/core/src/tests/blind/sublabel/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
SPDX-FileCopyrightText: 2023 Siemens AG
SPDX-License-Identifier: MIT
-->

<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"
/>
<title>Stencil Component Starter</title>
</head>
<body>
<ix-blind label="Some label" sublabel="Some sublabel">
<div>Content!</div>
</ix-blind>
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</head>
<body class="theme-brand-dark">
<!-- Preview code -->
<ix-blind label="Example" icon="info">
<ix-blind label="Example" icon="info" sublabel="Sublabel">
<ix-icon-button
id="context-menu"
slot="header-actions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import React from 'react';
export default () => {
return (
<>
<IxBlind label="Example">
<IxBlind label="Example" sublabel="Sublabel">
<IxIconButton
id="context-menu"
slot="header-actions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IxBlind, IxDropdown, IxIconButton } from '@siemens/ix-vue';
</script>

<template>
<IxBlind label="Example">
<IxBlind label="Example" sublabel="Sublabel">
<IxIconButton
slot="header-actions"
id="context-menu"
Expand Down
1 change: 1 addition & 0 deletions packages/vue/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const IxBasicNavigation = /*@__PURE__*/ defineContainer<JSX.IxBasicNaviga
export const IxBlind = /*@__PURE__*/ defineContainer<JSX.IxBlind>('ix-blind', undefined, [
'collapsed',
'label',
'sublabel',
'icon',
'collapsedChange'
]);
Expand Down

0 comments on commit 6c8c665

Please sign in to comment.