1/*
2 * Copyright (c) 2023-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
16const LOADINGPROGRESS_SIZE = 24
17const DEFAULT_MARGIN = 16
18const ITEM_SPACE = 4
19
20@Component
21export struct SwipeRefresher {
22  @Prop
23  content: string = null
24
25  @Prop
26  isLoading: boolean = false;
27
28  build() {
29    Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
30      if (this.isLoading) {
31        LoadingProgress()
32          .height(LOADINGPROGRESS_SIZE)
33          .width(LOADINGPROGRESS_SIZE)
34          .margin({
35            right: ITEM_SPACE
36          })
37      }
38      Text(this.content)
39        .fontColor($r('sys.color.ohos_id_color_text_secondary'))
40        .fontSize($r('sys.float.ohos_id_text_size_body2'))
41    }
42    .margin({
43      top: DEFAULT_MARGIN,
44      bottom: DEFAULT_MARGIN
45    })
46  }
47}