크리에이터 커뮤니티 페이지 추가
This commit is contained in:
45
SodaLive/Sources/CustomView/IconAndTitleToggleButton.swift
Normal file
45
SodaLive/Sources/CustomView/IconAndTitleToggleButton.swift
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// IconAndTitleToggleButton.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/12/15.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct IconAndTitleToggleButton: View {
|
||||
|
||||
@Binding var isChecked: Bool
|
||||
|
||||
let title: String
|
||||
let normalIconName: String
|
||||
let checkedIconName: String
|
||||
|
||||
let onClick: () -> Void
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 4) {
|
||||
Image(isChecked ? checkedIconName : normalIconName)
|
||||
|
||||
Text("\(title)")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color(hex: "d2d2d2"))
|
||||
}
|
||||
.padding(.horizontal, 13.3)
|
||||
.padding(.vertical, 5.3)
|
||||
.background(Color(hex: "ffffff").opacity(0.1))
|
||||
.cornerRadius(26.7)
|
||||
.onTapGesture { onClick() }
|
||||
}
|
||||
}
|
||||
|
||||
struct IconAndTitleToggleButton_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
IconAndTitleToggleButton(
|
||||
isChecked: .constant(true),
|
||||
title: "100",
|
||||
normalIconName: "ic_audio_content_heart_normal",
|
||||
checkedIconName: "ic_audio_content_heart_pressed"
|
||||
) {}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user