|
@@ -79,3 +79,41 @@ struct IconButton: View {
|
|
|
.buttonStyle(.plain)
|
|
.buttonStyle(.plain)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+struct ClearButton: View {
|
|
|
|
|
+ let action: () -> Void
|
|
|
|
|
+
|
|
|
|
|
+ @State private var isHovered = false
|
|
|
|
|
+
|
|
|
|
|
+ var body: some View {
|
|
|
|
|
+ Button(action: action) {
|
|
|
|
|
+ HStack(spacing: 6) {
|
|
|
|
|
+ Image(systemName: "eraser.fill")
|
|
|
|
|
+ .font(.system(size: 12, weight: .semibold))
|
|
|
|
|
+ .symbolRenderingMode(.hierarchical)
|
|
|
|
|
+
|
|
|
|
|
+ Text("Clear")
|
|
|
|
|
+ .font(.system(size: 12, weight: .semibold))
|
|
|
|
|
+ }
|
|
|
|
|
+ .foregroundStyle(isHovered ? AppTheme.clearForegroundHover : AppTheme.clearForeground)
|
|
|
|
|
+ .padding(.horizontal, 12)
|
|
|
|
|
+ .padding(.vertical, 7)
|
|
|
|
|
+ .background(isHovered ? AppTheme.clearBackgroundHover : AppTheme.clearBackground)
|
|
|
|
|
+ .clipShape(RoundedRectangle(cornerRadius: 8))
|
|
|
|
|
+ .overlay(
|
|
|
|
|
+ RoundedRectangle(cornerRadius: 8)
|
|
|
|
|
+ .stroke(isHovered ? AppTheme.clearForeground.opacity(0.35) : AppTheme.clearBorder, lineWidth: 1)
|
|
|
|
|
+ )
|
|
|
|
|
+ .shadow(
|
|
|
|
|
+ color: isHovered ? AppTheme.clearShadow : AppTheme.clearShadow.opacity(0.5),
|
|
|
|
|
+ radius: isHovered ? 6 : 3,
|
|
|
|
|
+ y: isHovered ? 3 : 1
|
|
|
|
|
+ )
|
|
|
|
|
+ .scaleEffect(isHovered ? 1.02 : 1.0)
|
|
|
|
|
+ .animation(.easeOut(duration: 0.15), value: isHovered)
|
|
|
|
|
+ }
|
|
|
|
|
+ .buttonStyle(.plain)
|
|
|
|
|
+ .onHover { isHovered = $0 }
|
|
|
|
|
+ .accessibilityLabel("Clear text")
|
|
|
|
|
+ }
|
|
|
|
|
+}
|