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 BatchSelectContactsPresenter from '../../../presenter/contact/batchselectcontacts/BatchSelectContactsPresenter';
17
18const TAG = 'BatchTabGuide ';
19
20@Component
21export default struct BatchTabGuide {
22  @State presenter: BatchSelectContactsPresenter = BatchSelectContactsPresenter.getInstance();
23  @Link currentIndex: number;
24  private controller: TabsController;
25
26  build() {
27    Flex({ direction: FlexDirection.Row,
28      justifyContent: FlexAlign.Center,
29      alignItems: ItemAlign.Center }) {
30
31      ForEach(this.presenter.tabTextSrc, (item, index) => {
32        Flex({ direction: FlexDirection.Column,
33          justifyContent: FlexAlign.End,
34          alignItems: ItemAlign.Center }) {
35          Text(item)
36            .fontSize($r('sys.float.ohos_id_text_size_body1'))
37            .fontColor(this.currentIndex == index ? $r('sys.color.ohos_id_color_connected') : $r('sys.color.ohos_id_color_text_tertiary'))
38            .textAlign(TextAlign.Center)
39            .margin({ top: 17, bottom: 6 })
40            .fontWeight(FontWeight.Medium)
41
42          Divider()
43            .width(index === 1 ? 56 : 32)
44            .vertical(false)
45            .strokeWidth(2)
46            .borderRadius(1)
47            .color($r('sys.color.ohos_id_color_connected'))
48            .visibility(this.currentIndex == index ? Visibility.Visible : Visibility.Hidden)
49        }
50        .width(120)
51        .height($r('app.float.id_item_height_large'))
52        .margin({ left: $r('app.float.id_card_margin_xl'), right: $r('app.float.id_card_margin_xl') })
53        .onClick(() => {
54          if (this.currentIndex != index) {
55            this.controller.changeIndex(index);
56          }
57        })
58
59      }, (item, index) => JSON.stringify(item))
60
61    }
62    .width('100%')
63    .height($r('app.float.id_item_height_large'))
64  }
65}