• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { Log } from '../../utils/Log';
17import { ActionBarProp } from '../browserOperation/ActionBarProp';
18
19const TAG: string = 'common_SingleTitle';
20
21// Single line title, fixed content
22@Component
23export struct SingleTitle {
24  @Link actionBarProp: ActionBarProp;
25
26  build() {
27    Row() {
28      Text(this.actionBarProp.getTitle())
29        .fontSize(this.actionBarProp.getIsHeadTitle()
30          ? ActionBarProp.HEAD_TITLE_ONE_LINE_TEXT_SIZE : ActionBarProp.TITLE_TEXT_SIZE)
31        .fontWeight(FontWeight.Medium)
32        .fontColor(ActionBarProp.NORMAL_TEXT_COLOR)
33        .maxLines(2)
34        .textOverflow({ overflow: TextOverflow.Ellipsis })
35        .key('SingleTitleText')
36    }
37    .alignItems(VerticalAlign.Center)
38    .flexGrow(1)
39  }
40
41  private onBuildDone(): void {
42    Log.info(TAG, `onBuildDone, title: ${this.actionBarProp.getTitle()}`)
43  }
44}