Skip to content

Commit 33d4971

Browse files
committed
[design] #183 float button modifier 구성
1 parent 9aca4aa commit 33d4971

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// PokitFloatButtonModifier.swift
3+
// DSKit
4+
//
5+
// Created by 김민호 on 1/16/25.
6+
//
7+
import SwiftUI
8+
9+
private struct PokitFloatButtonModifier: ViewModifier {
10+
let action: () -> Void
11+
12+
func body(content: Content) -> some View {
13+
content
14+
.overlay(alignment: .bottomTrailing) {
15+
Button(action: action) {
16+
Image(.icon(.plus))
17+
.resizable()
18+
.frame(width: 36, height: 36)
19+
.padding(12)
20+
.foregroundStyle(.pokit(.icon(.inverseWh)))
21+
.background {
22+
RoundedRectangle(cornerRadius: 9999, style: .continuous)
23+
.fill(.pokit(.bg(.brand)))
24+
}
25+
.frame(width: 60, height: 60)
26+
}
27+
.padding(.trailing, 20)
28+
.padding(.bottom, 39)
29+
}
30+
}
31+
}
32+
33+
public extension View {
34+
func pokitFloatButton(action: @escaping () -> Void) -> some View {
35+
return self.modifier(PokitFloatButtonModifier(action: action))
36+
}
37+
}
38+
39+
#Preview {
40+
ZStack {
41+
Color.black.ignoresSafeArea()
42+
.pokitFloatButton(action: {})
43+
}
44+
}

0 commit comments

Comments
 (0)