Skip to content

Commit

Permalink
YDSList 전달인자에 subHeaderText 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsoomin20221789 committed Nov 23, 2023
1 parent df73cd1 commit 4da294a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion YDS-Storybook/SwiftUI/Components/ListPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct ListPageView: View {
StorybookPageView(sample: {
VStack {
Spacer()
YDSList(hasSubHeader: isDisabled, items: [YDSListItem(text: "비밀번호 변경"),
YDSList(hasSubHeader: isDisabled, subHeaderText: "MY", items: [YDSListItem(text: "비밀번호 변경"),
YDSListItem(text: "계정관리", icon: true),
YDSListItem(text: "알림받기", toggle: true)])
Spacer()
Expand Down
14 changes: 8 additions & 6 deletions YDS-SwiftUI/Source/Component/YDSList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ import SwiftUI
import YDS_Essential

public struct YDSList: View {
var subheader: Bool?
var hasSubHeader: Bool?
var subHeaderText: String?
let items: [YDSListItem]

public init(hasSubHeader: Bool? = nil, items: [YDSListItem]) {
self.subheader = hasSubHeader
public init(hasSubHeader: Bool? = nil, subHeaderText: String? = nil, items: [YDSListItem]) {
self.hasSubHeader = hasSubHeader
self.subHeaderText = subHeaderText
self.items = items
}

public var body: some View {
VStack {
if let subheader = subheader, subheader {
if let hasSubHeader = hasSubHeader, hasSubHeader {
HStack {
Text("MY")
Text(subHeaderText ?? "")
.fontWeight(.semibold)
.foregroundColor(YDSColor.textSecondary)
.padding(20)
Expand All @@ -36,7 +38,7 @@ public struct YDSList: View {

struct YDSList_Previews: PreviewProvider {
static var previews: some View {
YDSList(hasSubHeader: true, items: [YDSListItem(text: "비밀번호 변경"),
YDSList(hasSubHeader: true, subHeaderText: "MY", items: [YDSListItem(text: "비밀번호 변경"),
YDSListItem(text: "계정관리", icon: true),
YDSListItem(text: "알림받기", toggle: true)])
}
Expand Down

0 comments on commit 4da294a

Please sign in to comment.