• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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 TAG = 'BaseByodAdminPage';
17
18@Component
19export struct BaseByodAdminPage {
20  @BuilderParam topBuilderParam: () => void = this.doNothingBuilder;
21  @BuilderParam centerBuilderParam: () => void = this.doNothingBuilder;
22  @BuilderParam bottomBuilderParam: () => void = this.doNothingBuilder;
23  @Prop listTitle: Resource | string = '';
24
25  @Builder
26  doNothingBuilder() {
27  };
28
29  build() {
30    Column() {
31      Column() {
32        Column() {
33          this.topBuilderParam();
34        }
35        .width('100%')
36        .height('56vp')
37        .padding({
38          top: '14.5vp',
39          bottom: '14.5vp'
40        })
41        .alignItems(HorizontalAlign.Start)
42
43        Column() {
44          List() {
45            ListItem() {
46              Text(this.listTitle)
47                .fontColor($r('sys.color.ohos_id_color_text_primary'))
48                .fontWeight(FontWeight.Bold)
49                .lineHeight('24vp')
50                .fontSize('18vp')
51            }
52            .padding({
53              top: '24vp',
54              bottom: '8vp'
55            })
56            .margin({
57              bottom: '8vp'
58            })
59
60            this.centerBuilderParam();
61          }
62          .width('100%')
63          .height('100%')
64        }
65        .height('80%')
66      }
67
68      Column() {
69        this.bottomBuilderParam();
70      }
71      .margin({
72        bottom: '16vp'
73      })
74    }
75    .width('100%')
76    .height('100%')
77    .justifyContent(FlexAlign.SpaceBetween)
78    .padding({
79      left: '16vp',
80      right: '16vp'
81    })
82  }
83}
84
85@Preview
86@Component
87export struct BottomButton {
88  @Require @Prop description: string | Resource = '';
89  @Require buttonWidth: string = '';
90  @Prop isEnabled: boolean = true;
91
92  build() {
93    Column() {
94      Button() {
95        Text(this.description)
96          .fontSize('16vp')
97          .lineHeight('21vp')
98          .fontFamily('HarmonyHeiTi')
99          .fontWeight(FontWeight.Medium)
100          .fontColor($r('sys.color.font_emphasize'))
101      }
102      .backgroundColor($r('sys.color.comp_background_tertiary'))
103      .width(this.buttonWidth)
104      .height('40vp')
105      .enabled(this.isEnabled)
106    }
107  }
108}
109