Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions projects/dashboards/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export * from './widgets/interactive-data-widget-renderer';
export * from './widgets/header/widget-header.model';
export * from './widgets/container/container-widget.model';
export * from './widgets/link/link-widget.model';
export * from './widgets/text/text-widget-types';

export * from './dashboard.module';
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
.text-widget {
@include ellipsis-overflow();

.primary-text {
.title {
@include header-3();
}

.section-title {
@include subtitle-1($gray-7);
text-transform: capitalize;
}

.secondary-text {
@include body-small($gray-4);
padding-left: 4px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { TextWidgetModel } from './text-widget.model';
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="text-widget">
<span class="primary-text">{{ this.model.text }}</span>
<span class="primary-text" [ngClass]="this.model.primaryTextStyle">{{ this.model.text }}</span>
<span class="secondary-text">{{ this.model.secondaryText }}</span>
</div>
`
Expand Down
4 changes: 4 additions & 0 deletions projects/dashboards/src/widgets/text/text-widget-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const enum PrimaryTextStyle {
Title = 'title',
SectionTitle = 'section-title'
}
13 changes: 13 additions & 0 deletions projects/dashboards/src/widgets/text/text-widget.model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Model, ModelProperty, STRING_PROPERTY } from '@hypertrace/hyperdash';
import { EnumPropertyTypeInstance, ENUM_TYPE } from '../../properties/enums/enum-property-type';
import { PrimaryTextStyle } from './text-widget-types';

@Model({
type: 'text-widget'
Expand All @@ -17,4 +19,15 @@ export class TextWidgetModel {
required: false
})
public secondaryText?: string;

@ModelProperty({
key: 'primary-text-style',
required: false,
// tslint:disable-next-line: no-object-literal-type-assertion
type: {
key: ENUM_TYPE.type,
values: [PrimaryTextStyle.Title, PrimaryTextStyle.SectionTitle]
} as EnumPropertyTypeInstance
})
public primaryTextStyle?: string = PrimaryTextStyle.Title;
}