import { ToolMenuEntity } from '../entity/ToolMenuEntity'

@ComponentV2
export struct ToolItemView {
  @Param menu?: ToolMenuEntity = undefined

  build() {
    Column() {
      Row() {
        Image(this.menu?.icon).width(44).height(44).margin({left: 12, top: 16, bottom: 16})
        Column() {
          Text(this.menu?.title).fontColor($r('app.color.color_212226')).fontSize(16).fontWeight(FontWeight.Medium)
          Text(this.menu?.desc).fontColor($r('app.color.color_666666')).fontSize(12).margin({top: 4})
        }
        .margin({left: 12})
        .alignItems(HorizontalAlign.Start)
      }
      .width('100%')
      .borderRadius({topLeft: 8, topRight: 8})
      .linearGradient({
        direction: GradientDirection.Bottom,
        colors: [[this.menu?.colors[0], 0.0], [this.menu?.colors[1], 1.0]]
      })

      Row() {
        Text(this.menu?.count + 'w人使用').fontColor($r('app.color.color_999999')).fontSize(12).layoutWeight(1)
        Image($r('app.media.ic_tool_arrow')).width(20).height(20)
      }
      .padding({left:12, top: 8, right: 12, bottom: 8 })
    }
    .width('100%')
    .borderRadius(8)
    .backgroundColor(Color.White)
    .padding(1)
    .alignItems(HorizontalAlign.Start)
  }
}