Browse Source

test

Signed-off-by: marinofaggiana <marino.faggiana@nextcloud.com>
marinofaggiana 2 years ago
parent
commit
5821a0dfc8
2 changed files with 23 additions and 23 deletions
  1. 17 19
      DashboardWidget/DashBoardList.swift
  2. 6 4
      DashboardWidget/DashboardData.swift

+ 17 - 19
DashboardWidget/DashBoardList.swift

@@ -28,26 +28,24 @@ struct DashBoardList: View {
 struct DashboardElement: View {
     var element: DashboardData
     var body: some View {
-        HStack {
-            Image(element.image)
-                .resizable()
-                .aspectRatio(contentMode: .fit)
-                .frame(width: 40, height: 40)
-                .clipShape(Circle())
-            VStack(alignment: .leading) {
-                Text(element.title)
-                    .font(.headline)
-                Text(element.subTitle)
-                    .font(.subheadline)
-                    .foregroundColor(.accentColor)
+        Link(destination: element.url) {
+            HStack {
+                Image(element.image)
+                    .resizable()
+                    .aspectRatio(contentMode: .fit)
+                    .frame(width: 40, height: 40)
+                    .clipShape(Circle())
+                VStack(alignment: .leading) {
+                    Text(element.title)
+                        .font(.headline)
+                    Text(element.subTitle)
+                        .font(.subheadline)
+                        .foregroundColor(.accentColor)
+                }
+                Spacer()
             }
-            Spacer()
-        }.padding(10)
-        //.overlay(
-            //RoundedRectangle(cornerRadius: 8)
-             //   .stroke(Color(.sRGB, red: 150 / 255, green: 150 / 255, blue: 150 / 255, opacity: 0.4), lineWidth: 1)
-        //)
-        .shadow(radius: 1)
+            .padding(10)
+        }
     }
 }
 

+ 6 - 4
DashboardWidget/DashboardData.swift

@@ -13,11 +13,13 @@ struct DashboardData: Identifiable, Codable, Hashable {
     var image: String
     var title: String
     var subTitle: String
+    var url: URL
 }
 
 let dataDashboardPreview: [DashboardData] = [
-    .init(id: 1, image: "nextcloud", title: "The Weeknd", subTitle: "theweeknd-after-hours"),
-    .init(id: 2, image: "nextcloud", title: "Lil Uzi", subTitle: "eternalatake-liluzivert"),
-    .init(id: 3, image: "nextcloud", title: "Dua Lipa", subTitle: "dualipa-bReAK mY heART"),
-    .init(id: 4, image: "nextcloud", title: "Kanye West", subTitle: "kaynewest-jesusisking")
+    .init(id: 1, image: "nextcloud", title: "The Weeknd", subTitle: "theweeknd-after-hours", url: URL(string: "https://nextcloud.com/1")!),
+    .init(id: 2, image: "nextcloud", title: "Lil Uzi", subTitle: "eternalatake-liluzivert", url: URL(string: "https://nextcloud.com/2")!),
+    .init(id: 3, image: "nextcloud", title: "Dua Lipa", subTitle: "dualipa-bReAK mY heART", url: URL(string: "https://nextcloud.com/3")!),
+    .init(id: 4, image: "nextcloud", title: "Kanye West", subTitle: "kaynewest-jesusisking", url: URL(string: "https://nextcloud.com/4")!),
+    .init(id: 5, image: "nextcloud", title: "Kanye West", subTitle: "kaynewest-jesusisking", url: URL(string: "https://nextcloud.com/5")!)
 ]