Mercurial > public > lazybear
view LazyBear/Views/Global Helpers/RowShape.swift @ 424:6dd97877f575
Improve code, reorganize files
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sun, 13 Jun 2021 19:40:42 +0200 |
parents | 2984d8946342 |
children | 8c58ce834d95 |
line wrap: on
line source
// // RowShape.swift // LazyBear // // Created by Dennis Concepción Martín on 5/6/21. // import SwiftUI struct RowShape: View { @Environment(\.colorScheme) var colorScheme var body: some View { RoundedRectangle(cornerRadius: 25) .foregroundColor(Color("CustomSecondaryBackground")) .if(colorScheme == .light) { content in // Apply shadow only when is not dark mode content .shadow(color: Color(.gray).opacity(0.15), radius: 10) } } } /* Apply modifiers to the passed view on some condition */ extension View { @ViewBuilder func `if`<Content: View>(_ conditional: Bool, content: (Self) -> Content) -> some View { if conditional { content(self) } else { self } } } struct RowShape_Previews: PreviewProvider { static var previews: some View { RowShape() } }