Skip to content

Commit

Permalink
fix(MetadataBase): updates types declarations (#318)
Browse files Browse the repository at this point in the history
* fix(MetadataBase): updates type declarations
  • Loading branch information
arwehrman authored Aug 2, 2023
1 parent 5185be5 commit 2713f2c
Showing 1 changed file with 102 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
* SPDX-License-Identifier: Apache-2.0
*/

import lng from '@lightningjs/core';
import Base from '../Base';
import type { StylePartial } from '../../types/lui';
import type { TextBoxStyle } from '../TextBox';
import { StylePartial } from '../../types/lui';
import TextBox, { TextBoxStyle } from '../TextBox';
import Icon from '../Icon';

export type MetadataBaseStyle = {
type MetadataBaseStyle = {
descriptionTextStyle: TextBoxStyle;
fadeWidth: number;
logoWidth: number;
Expand All @@ -30,15 +32,107 @@ export type MetadataBaseStyle = {
titleTextStyle: TextBoxStyle;
};

export default class MetadataBase extends Base {
title?: string;
subtitle?: string;
declare namespace MetadataBase {
export interface TemplateSpec extends Base.TemplateSpec {
/**
* third line or description of the content
*/
description?: string;
/**
* logo to display at bottom of component
*/
logo?: string;
/**
* height of logo
*/
logoHeight?: number;
/**
* width of logo
*/
logoWidth?: number;
/**
* which side to place logo (`right` or `left`)
*/
logoPosition?: string;
/**
* title of logo to use for announcer
*/
logoTitle?: string;
/**
* sets the marquee for Title and Description to the same value so they sync
*/
marquee?: boolean;
/**
* relevant content data in the middle
*/
subtitle?: string;
/**
* first line or headline of the content
*/
title?: string;
}
export interface TypeConfig extends lng.Component.TypeConfig {
SignalMapType: SignalMap;
}
/**
* emits when an update to the height of logo and/or text happens
*/
export type SignalMap = {
updateMetadataHeight(): void;
};
}

declare class MetadataBase<
TemplateSpec extends MetadataBase.TemplateSpec = MetadataBase.TemplateSpec,
TypeConfig extends MetadataBase.TypeConfig = MetadataBase.TypeConfig
> extends Base<TemplateSpec, TypeConfig> {
// Properties
/**
* third line or description of the content
*/
description?: string;
/**
* logo to display at bottom of component
*/
logo?: string;
logoWidth?: number;
/**
* height of logo
*/
logoHeight?: number;
logoTitle?: string;
/**
* width of logo
*/
logoWidth?: number;
/**
* which side to place logo (`right` or `left`)
*/
logoPosition?: string;
/**
* title of logo to use for announcer
*/
logoTitle?: string;
/**
* TODO: confirm type and get a description
*/
marquee?: boolean;
/**
* relevant content data in the middle
*/
subtitle?: string;
/**
* first line or headline of the content
*/
title?: string;

get style(): MetadataBaseStyle;
set style(v: StylePartial<MetadataBaseStyle>);

// Tags
get _Title(): TextBox;
get _SubtitleWrapper(): TextBox;
get _Subtitle(): TextBox;
get _Description(): TextBox;
get _Logo(): Icon;
}

export { MetadataBase as default, MetadataBaseStyle };

0 comments on commit 2713f2c

Please sign in to comment.