1/*
2 * Copyright (c) 2021-2023 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
16@Component
17export struct Loading {
18  @Prop isLoading: boolean
19  iconWidth: number = 60
20  iconHeight: number = 60
21  color: Resource = $r('sys.color.ohos_id_color_text_secondary')
22  title: Resource = $r('app.string.loading')
23  containerHeight: number | string = '100%'
24
25  build() {
26    Column() {
27      LoadingProgress()
28        .width(this.iconWidth)
29        .height(this.iconHeight)
30        .color(this.color)
31
32      Text(this.title)
33        .fontSize($r('sys.float.ohos_id_text_size_body2'))
34        .fontColor($r('sys.color.ohos_id_color_text_secondary'))
35        .margin({ top: 5 })
36    }
37    .width('100%')
38    .height(this.containerHeight)
39    .alignItems(HorizontalAlign.Center)
40    .justifyContent(FlexAlign.Center)
41    .visibility(this.isLoading ? Visibility.Visible : Visibility.None)
42  }
43}