Skip to content

Commit

Permalink
[design] #157 버튼 컴포넌트 패딩, 사이즈 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ShapeKim98 committed Nov 26, 2024
1 parent 21cd383 commit 2b4275f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 60 deletions.
27 changes: 3 additions & 24 deletions Projects/DSKit/Sources/Components/PoKitIconRButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public struct PokitIconRButton: View {
.frame(width: self.size.iconSize.width, height: self.size.iconSize.height)
.foregroundStyle(self.state.iconColor)
}
.padding(.leading, self.lPadding)
.padding(.trailing, self.tPadding)
.padding(.leading, self.size.hPadding + 4)
.padding(.trailing, self.size.hPadding)
.padding(.vertical, self.size.vPadding)
.background {
RoundedRectangle(cornerRadius: shape.radius(size: self.size), style: .continuous)
Expand All @@ -61,27 +61,6 @@ public struct PokitIconRButton: View {
.stroke(self.state.backgroundStrokeColor, lineWidth: 1)
}
}
}

private var tPadding: CGFloat {
switch self.size {
case .small:
return 8
case .medium:
return 16
case .large:
return 20
}
}

private var lPadding: CGFloat {
switch self.size {
case .small:
return 12
case .medium:
return 20
case .large:
return 24
}
.frame(minWidth: self.size.minWidth)
}
}
27 changes: 3 additions & 24 deletions Projects/DSKit/Sources/Components/PokitIconLButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public struct PokitIconLButton: View {
.pokitFont(self.size.font)
.foregroundStyle(self.state.textColor)
}
.padding(.leading, self.lPadding)
.padding(.trailing, self.tPadding)
.padding(.leading, self.size.hPadding)
.padding(.trailing, self.size.hPadding + 4)
.padding(.vertical, self.size.vPadding)
.background {
RoundedRectangle(cornerRadius: shape.radius(size: self.size), style: .continuous)
Expand All @@ -60,27 +60,6 @@ public struct PokitIconLButton: View {
.stroke(self.state.backgroundStrokeColor, lineWidth: 1)
}
}
}

private var lPadding: CGFloat {
switch self.size {
case .small:
return 8
case .medium:
return 16
case .large:
return 20
}
}

private var tPadding: CGFloat {
switch self.size {
case .small:
return 12
case .medium:
return 20
case .large:
return 24
}
.frame(minWidth: self.size.minWidth)
}
}
14 changes: 2 additions & 12 deletions Projects/DSKit/Sources/Components/PokitTextButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public struct PokitTextButton: View {
Text(self.labelText)
.pokitFont(self.size.font)
.foregroundStyle(self.state.textColor)
.padding(.horizontal, self.hPadding)
.padding(.horizontal, self.size.hPadding)
.padding(.vertical, self.size.vPadding)
.background {
RoundedRectangle(cornerRadius: shape.radius(size: self.size), style: .continuous)
Expand All @@ -49,16 +49,6 @@ public struct PokitTextButton: View {
.stroke(self.state.backgroundStrokeColor, lineWidth: 1)
}
}
}

private var hPadding: CGFloat {
switch self.size {
case .small:
return 12.5
case .medium:
return 26
case .large:
return 34.5
}
.frame(minWidth: self.size.minWidth)
}
}
16 changes: 16 additions & 0 deletions Projects/DSKit/Sources/Foundation/PokitButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,22 @@ extension PokitButtonStyle.Size {
case .large: return 13
}
}

var hPadding: CGFloat {
switch self {
case .small: return 8
case .medium: return 16
case .large: return 20
}
}

var minWidth: CGFloat {
switch self {
case .small: return 50
case .medium: return 80
case .large: return 100
}
}
}

extension PokitButtonStyle.Shape {
Expand Down

0 comments on commit 2b4275f

Please sign in to comment.