Browse Source

Updated the button to the new on-brand style.

Changelog-Changed: Updated post button color
post-button-style
Ben Weeks 2 years ago
committed by William Casarin
parent
commit
94b1342b20
  1. 6
      damus/Assets.xcassets/TabView/Contents.json
  2. 21
      damus/Assets.xcassets/TabView/ic-home.imageset/Contents.json
  3. BIN
      damus/Assets.xcassets/TabView/ic-home.imageset/ic-home.png
  4. 21
      damus/Assets.xcassets/TabView/ic-messages.imageset/Contents.json
  5. BIN
      damus/Assets.xcassets/TabView/ic-messages.imageset/ic-messages.png
  6. 21
      damus/Assets.xcassets/TabView/ic-notifications.imageset/Contents.json
  7. BIN
      damus/Assets.xcassets/TabView/ic-notifications.imageset/ic-notifications.png
  8. 21
      damus/Assets.xcassets/TabView/ic-search.imageset/Contents.json
  9. BIN
      damus/Assets.xcassets/TabView/ic-search.imageset/ic-search.png
  10. 6
      damus/Assets.xcassets/Toolbar/Contents.json
  11. 51
      damus/Assets.xcassets/Toolbar/ic-settings.imageset/Contents.json
  12. BIN
      damus/Assets.xcassets/Toolbar/ic-settings.imageset/ic-settings.png
  13. 21
      damus/Assets.xcassets/ic-add.imageset/Contents.json
  14. BIN
      damus/Assets.xcassets/ic-add.imageset/ic-add.png
  15. 5
      damus/ContentView.swift
  16. 33
      damus/Views/MainTabView.swift
  17. 26
      damus/Views/PostButton.swift

6
damus/Assets.xcassets/TabView/Contents.json

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

21
damus/Assets.xcassets/TabView/ic-home.imageset/Contents.json

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "ic-home.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

BIN
damus/Assets.xcassets/TabView/ic-home.imageset/ic-home.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

21
damus/Assets.xcassets/TabView/ic-messages.imageset/Contents.json

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "ic-messages.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

BIN
damus/Assets.xcassets/TabView/ic-messages.imageset/ic-messages.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

21
damus/Assets.xcassets/TabView/ic-notifications.imageset/Contents.json

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "ic-notifications.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

BIN
damus/Assets.xcassets/TabView/ic-notifications.imageset/ic-notifications.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

21
damus/Assets.xcassets/TabView/ic-search.imageset/Contents.json

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "ic-search.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

BIN
damus/Assets.xcassets/TabView/ic-search.imageset/ic-search.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

6
damus/Assets.xcassets/Toolbar/Contents.json

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

51
damus/Assets.xcassets/Toolbar/ic-settings.imageset/Contents.json

@ -0,0 +1,51 @@
{
"images" : [
{
"filename" : "ic-settings.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

BIN
damus/Assets.xcassets/Toolbar/ic-settings.imageset/ic-settings.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

21
damus/Assets.xcassets/ic-add.imageset/Contents.json

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "ic-add.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

BIN
damus/Assets.xcassets/ic-add.imageset/ic-add.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

5
damus/ContentView.swift

@ -241,7 +241,10 @@ struct ContentView: View {
} }
NavigationLink(destination: ConfigView(state: damus_state!).environmentObject(user_settings)) { NavigationLink(destination: ConfigView(state: damus_state!).environmentObject(user_settings)) {
Label("", systemImage: "gear") Label {
Text("Settings")
} icon: { Image("ic-settings") }
.labelStyle(IconOnlyLabelStyle())
} }
.buttonStyle(PlainButtonStyle()) .buttonStyle(PlainButtonStyle())
} }

33
damus/Views/MainTabView.swift

@ -57,11 +57,24 @@ struct TabButton: View {
action(timeline) action(timeline)
new_events = NewEventsBits(prev: new_events, unsetting: timeline) new_events = NewEventsBits(prev: new_events, unsetting: timeline)
}) { }) {
Label("", systemImage: selected == timeline ? "\(img).fill" : img) if selected == timeline {
// Show the selected item as highlighted
LinearGradient(gradient: Gradient(colors: [
Color(red: 0.8, green: 0.263, blue: 0.773),
Color(red: 0.224, green: 0.302, blue: 0.886)
]), startPoint: .topTrailing, endPoint: .bottomTrailing)
.mask(Image(img)
.contentShape(Rectangle())
.frame(width: 24, height: 24)
)
.contentShape(Rectangle()) .contentShape(Rectangle())
.frame(maxWidth: .infinity, minHeight: 30.0) .frame(width: 24, height: 24)
} else {
Image(img)
.contentShape(Rectangle())
.frame(width: 24, height: 24)
}
} }
.foregroundColor(selected != timeline ? .gray : .primary)
} }
} }
@ -76,10 +89,16 @@ struct TabBar: View {
VStack { VStack {
Divider() Divider()
HStack { HStack {
TabButton(timeline: .home, img: "house", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("1") // Might want to consider using TabView and NavigationView.tabItem's here
TabButton(timeline: .dms, img: "bubble.left.and.bubble.right", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("2") Spacer()
TabButton(timeline: .search, img: "magnifyingglass.circle", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("3") TabButton(timeline: .home, img: "ic-home", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("1")
TabButton(timeline: .notifications, img: "bell", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("4") Spacer()
TabButton(timeline: .dms, img: "ic-messages", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("2")
Spacer()
TabButton(timeline: .search, img: "ic-search", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("3")
Spacer()
TabButton(timeline: .notifications, img: "ic-notifications", selected: $selected, new_events: $new_events, action: action).keyboardShortcut("4")
Spacer()
} }
} }
} }

26
damus/Views/PostButton.swift

@ -9,21 +9,18 @@ import Foundation
import SwiftUI import SwiftUI
func PostButton(action: @escaping () -> ()) -> some View { func PostButton(action: @escaping () -> ()) -> some View {
return Button(action: action, label: { return Button(action: action) {
Text("+") Label {
.font(.system(.largeTitle)) Text("+")
.frame(width: 57, height: 50) } icon: {
.foregroundColor(Color.white) Image("ic-add")
.padding(.bottom, 7) .contentShape(Circle())
}) .frame(width: 60, height: 60)
.background(Color.accentColor) }
.cornerRadius(38.5) .labelStyle(IconOnlyLabelStyle())
.padding() }
.shadow(color: Color.black.opacity(0.3),
radius: 3,
x: 3,
y: 3)
.keyboardShortcut("n", modifiers: [.command, .shift]) .keyboardShortcut("n", modifiers: [.command, .shift])
.offset(x: -10, y: -10)
} }
func PostButtonContainer(action: @escaping () -> ()) -> some View { func PostButtonContainer(action: @escaping () -> ()) -> some View {
@ -36,4 +33,3 @@ func PostButtonContainer(action: @escaping () -> ()) -> some View {
} }
} }
} }

Loading…
Cancel
Save