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_DetailTitle';
20
21// Large picture title, including primary date title and secondary time and place title
22@Component
23export struct DetailTitle {
24  @Consume('dateTitle') title: string;
25  @Consume('timeLocationTitle') subTitle: string;
26  isVideoPage: boolean = false;
27
28  build() {
29    Row() {
30      Column() {
31        Text(this.title)
32          .fontSize(ActionBarProp.TITLE_TEXT_SIZE)
33          .fontColor(this.isVideoPage ? $r('app.color.white') : ActionBarProp.NORMAL_TEXT_COLOR)
34          .fontWeight(FontWeight.Medium)
35          .maxLines(1)
36          .textOverflow({ overflow: TextOverflow.Ellipsis })
37          .key('PhotoBrowserDateTitle')
38        Text(this.subTitle)
39          .fontSize(ActionBarProp.SUBTITLE_TEXT_SIZE)
40          .fontFamily(ActionBarProp.REGULAR_FONT)
41          .fontColor(this.isVideoPage ? $r('app.color.white') : ActionBarProp.NORMAL_SUBTITLE_TEXT_COLOR)
42          .maxLines(1)
43          .lineHeight(18)
44          .margin({ top: $r('sys.float.ohos_id_text_margin_vertical') })
45          .textOverflow({ overflow: TextOverflow.Ellipsis })
46          .key('PhotoBrowserTimeLocationTitle')
47      }
48      .constraintSize({ minHeight: 48 })
49      .alignItems(HorizontalAlign.Start)
50    }
51    .alignItems(VerticalAlign.Center)
52  }
53
54  private onBuildDone(): void {
55    Log.debug(TAG, `onBuildDone, title: ${this.title}, subTitle: ${this.subTitle}`)
56  }
57}