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

fix(MetadataBase): updates types declarations #318

Merged
merged 3 commits into from
Aug 2, 2023
Merged
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
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 };
Loading