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 AccountantsPresenter from '../../../presenter/contact/accountants/AccountantsPresenter';
17
18@Component
19export struct AddItem {
20  @Link mPresent: AccountantsPresenter;
21  private labelName: Resource;
22  private typeName: string;
23  @LocalStorageProp('breakpoint') curBp: string = 'sm';
24
25  build() {
26    Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
27      Column() {
28        Text(this.labelName)
29          .fontSize($r('sys.float.ohos_id_text_size_body1'))
30          .fontWeight(FontWeight.Medium)
31          .fontColor($r('sys.color.ohos_id_color_text_secondary'))
32      }
33      .alignItems(HorizontalAlign.Start)
34      .flexGrow(1)
35
36      Column() {
37        Image($r('app.media.ic_public_add_norm_filled'))
38          .objectFit(ImageFit.Contain)
39          .height($r('app.float.id_card_image_small'))
40          .width($r('app.float.id_card_image_small'))
41          .fillColor($r('sys.color.ohos_id_color_tertiary'))
42      }
43      .margin({ right: this.curBp === 'lg' ? $r('app.float.id_card_margin_max') : $r('app.float.id_card_margin_xl') })
44      .alignItems(HorizontalAlign.End)
45    }
46    .onClick(() => {
47      this.mPresent.addMore(this.typeName);
48    })
49    .margin({ left: $r('app.float.id_card_margin_xxl') })
50    .height(this.curBp === 'lg' ? $r('app.float.id_item_height_large') : $r('app.float.id_item_height_mid'))
51  }
52}