Add link button on iPad

This commit is contained in:
Jackson Harper 2023-07-26 19:36:49 +08:00
parent ac38ca2e86
commit 2fd841775d
3 changed files with 27 additions and 14 deletions

View file

@ -150,7 +150,7 @@ struct AnimatingCellHeight: AnimatableModifier {
Label(LocalText.genericProfile, systemImage: "person.circle")
})
Button(action: { addLinkPresented = true }, label: {
Label("Add Link", systemImage: "plus.square")
Label("Add Link", systemImage: "plus.circle")
})
}, label: {
Image.utilityMenu

View file

@ -61,6 +61,7 @@
Form {
TextField("Add Link", text: $newLinkURL)
.keyboardType(.URL)
.autocorrectionDisabled(true)
.textFieldStyle(StandardTextFieldStyle())
.focused($focusedField, equals: .addLinkEditor)

View file

@ -56,27 +56,39 @@ import Views
}
@MainActor struct PrimaryContentSidebar: View {
@State private var addLinkPresented = false
@State private var selectedCategory: PrimaryContentCategory?
let categories: [PrimaryContentCategory]
var innerBody: some View {
List(categories) { category in
NavigationLink(
destination: category.destinationView,
tag: category,
selection: $selectedCategory,
label: { category.listLabel }
)
#if os(iOS)
.listRowBackground(
category == selectedCategory
? Color.appGraySolid.opacity(0.4).cornerRadius(8)
: Color.clear.cornerRadius(8)
List {
ForEach(categories, id: \.self) { category in
NavigationLink(
destination: category.destinationView,
tag: category,
selection: $selectedCategory,
label: { category.listLabel }
)
#endif
#if os(iOS)
.listRowBackground(
category == selectedCategory
? Color.appGraySolid.opacity(0.4).cornerRadius(8)
: Color.clear.cornerRadius(8)
)
#endif
}
Button(action: { addLinkPresented = true }, label: {
Label("Add Link", systemImage: "plus.circle")
})
}
.dynamicTypeSize(.small ... .large)
.listStyle(.sidebar)
.sheet(isPresented: $addLinkPresented) {
NavigationView {
LibraryAddLinkView()
}
}
}
var body: some View {