1c41cb6d2Sopenharmony_ci/** 2c41cb6d2Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3c41cb6d2Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4c41cb6d2Sopenharmony_ci * you may not use this file except in compliance with the License. 5c41cb6d2Sopenharmony_ci * You may obtain a copy of the License at 6c41cb6d2Sopenharmony_ci * 7c41cb6d2Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8c41cb6d2Sopenharmony_ci * 9c41cb6d2Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10c41cb6d2Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11c41cb6d2Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12c41cb6d2Sopenharmony_ci * See the License for the specific language governing permissions and limitations 13c41cb6d2Sopenharmony_ci * under the License. 14c41cb6d2Sopenharmony_ci */ 15c41cb6d2Sopenharmony_ciimport ComponentConfig from './ComponentConfig'; 16c41cb6d2Sopenharmony_ciimport Router from '@system.router'; 17c41cb6d2Sopenharmony_ci 18c41cb6d2Sopenharmony_ci/** 19c41cb6d2Sopenharmony_ci * long head custom component 20c41cb6d2Sopenharmony_ci */ 21c41cb6d2Sopenharmony_ci@Component 22c41cb6d2Sopenharmony_ciexport default struct LongHeadComponent { 23c41cb6d2Sopenharmony_ci private isActive: boolean= true; 24c41cb6d2Sopenharmony_ci private icBackIsVisibility: boolean= true; 25c41cb6d2Sopenharmony_ci private longHeadName: string | Resource = ''; 26c41cb6d2Sopenharmony_ci 27c41cb6d2Sopenharmony_ci build() { 28c41cb6d2Sopenharmony_ci Row() { 29c41cb6d2Sopenharmony_ci Stack({ alignContent: Alignment.Center }) { 30c41cb6d2Sopenharmony_ci Image($r('app.media.ic_back')) 31c41cb6d2Sopenharmony_ci .height($r('app.float.wh_value_24')) 32c41cb6d2Sopenharmony_ci .width($r('app.float.wh_value_24')) 33c41cb6d2Sopenharmony_ci .fillColor($r('sys.color.ohos_id_color_primary')) 34c41cb6d2Sopenharmony_ci } 35c41cb6d2Sopenharmony_ci .margin({ right: $r('app.float.wh_value_12') }) 36c41cb6d2Sopenharmony_ci .backgroundColor($r('app.color.color_00000000_transparent')) 37c41cb6d2Sopenharmony_ci .visibility(this.icBackIsVisibility ? Visibility.Visible : Visibility.None) 38c41cb6d2Sopenharmony_ci .onClick(() => { 39c41cb6d2Sopenharmony_ci Router.back(); 40c41cb6d2Sopenharmony_ci }) 41c41cb6d2Sopenharmony_ci 42c41cb6d2Sopenharmony_ci Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { 43c41cb6d2Sopenharmony_ci Text(this.longHeadName) 44c41cb6d2Sopenharmony_ci .fontSize($r('app.float.head_font_24')) 45c41cb6d2Sopenharmony_ci .fontColor($r('app.color.font_color_182431')) 46c41cb6d2Sopenharmony_ci .lineHeight($r('app.float.wh_value_0')) 47c41cb6d2Sopenharmony_ci .fontWeight(FontWeight.Bold) 48c41cb6d2Sopenharmony_ci .maxLines(ComponentConfig.MAX_LINES_3) 49c41cb6d2Sopenharmony_ci .textOverflow({ overflow: TextOverflow.Ellipsis }) 50c41cb6d2Sopenharmony_ci .width('90%') 51c41cb6d2Sopenharmony_ci .textAlign(TextAlign.Start); 52c41cb6d2Sopenharmony_ci } 53c41cb6d2Sopenharmony_ci .width(ComponentConfig.WH_100_100) 54c41cb6d2Sopenharmony_ci .height($r('app.float.wh_value_56')) 55c41cb6d2Sopenharmony_ci .width('90%') 56c41cb6d2Sopenharmony_ci } 57c41cb6d2Sopenharmony_ci .width(ComponentConfig.WH_100_100) 58c41cb6d2Sopenharmony_ci .padding({ left: $r('app.float.wh_value_30') }) 59c41cb6d2Sopenharmony_ci .height($r('app.float.wh_value_56')) 60c41cb6d2Sopenharmony_ci .alignItems(VerticalAlign.Center) 61c41cb6d2Sopenharmony_ci .align(Alignment.Center) 62c41cb6d2Sopenharmony_ci } 63c41cb6d2Sopenharmony_ci}