Compound icons part III - Revenge of the SF Symbol (#2093)

* Use Compound in StartChat screen.

* Update location sharing icons.
This commit is contained in:
Doug
2023-11-16 15:50:06 +00:00
committed by GitHub
parent 5a1e02faeb
commit 0831c898ef
46 changed files with 215 additions and 1575 deletions
@@ -14,15 +14,56 @@
// limitations under the License.
//
import Compound
import SwiftUI
struct LocationMarkerView: View {
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
var mode: Mode = .map
enum Mode { case map, button }
private let pinColor: Color = .compound.iconOnSolidPrimary
private let pinInsets = EdgeInsets(top: 13, leading: 12, bottom: 15, trailing: 12)
private let buttonScale: Double = 28 / 52
var body: some View {
Image(Asset.Images.locationMarker.name)
switch mode {
case .map: mapMarker
case .button: buttonMarker
}
}
var mapMarker: some View {
CompoundIcon(asset: Asset.Images.locationPinSolid)
.dynamicTypeSize(.large)
.foregroundStyle(pinColor)
.padding(pinInsets)
.background {
backgroundShape
.shadow(color: .black.opacity(0.2), radius: 4.1129, x: 0, y: 4.93548)
}
.alignmentGuide(VerticalAlignment.center) { dimensions in
dimensions[.bottom]
}
.shadow(color: .black.opacity(0.2), radius: 8, x: 0, y: 5)
}
var buttonMarker: some View {
CompoundIcon(asset: Asset.Images.locationPinSolid, size: .custom(13), relativeTo: .body)
.foregroundStyle(pinColor)
.scaledPadding(.top, pinInsets.top * buttonScale)
.scaledPadding(.bottom, pinInsets.bottom * buttonScale)
.scaledPadding(.horizontal, pinInsets.leading * buttonScale)
.background {
backgroundShape
}
}
var backgroundShape: some View {
Image(asset: Asset.Images.locationMarkerShape)
.resizable()
.aspectRatio(contentMode: .fill)
.foregroundStyle(.compound.iconPrimary)
}
}
@@ -33,6 +74,11 @@ struct LocationMarkerView_Previews: PreviewProvider, TestablePreview {
LocationMarkerView()
.colorScheme(.dark)
LocationMarkerView(mode: .button)
LocationMarkerView(mode: .button)
.colorScheme(.dark)
}
}
}