Skip to content

Commit

Permalink
Merge pull request #480 from DeveloperAcademy-POSTECH/feature/471-exp…
Browse files Browse the repository at this point in the history
…loreshortcutviewmodel

[Feat] ExploreShortcutViewModel 생성
  • Loading branch information
jim4020key authored Aug 12, 2023
2 parents ba2f9b6 + bf2a253 commit 909dc74
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,11 @@ extension ExploreShortcutView {

ForEach(Array(shortcuts.enumerated()), id:\.offset) { index, shortcut in
if index < 3 {
let data = NavigationReadShortcutType(shortcutID:shortcut.id,
navigationParentView: .shortcuts)

ShortcutCell(shortcut: shortcut,
rankNumber: index + 1,
navigationParentView: .shortcuts)
.navigationLinkRouter(data: data)
.navigationLinkRouter(data: shortcut)
}
}
.background(Color.shortcutsZipBackground)
Expand All @@ -158,15 +156,11 @@ extension ExploreShortcutView {
ScrollView(.horizontal, showsIndicators: false) {
HStack {
ForEach(viewModel.fetchShortcuts(by: category).prefix(7), id: \.self) { shortcut in
let data = NavigationReadShortcutType(
shortcutID: shortcut.id,
navigationParentView: .shortcuts)

ShortcutCardCell(
categoryShortcutIcon: shortcut.sfSymbol,
categoryShortcutName: shortcut.title,
categoryShortcutColor: shortcut.color)
.navigationLinkRouter(data: data)
ShortcutCardCell(categoryShortcutIcon: shortcut.sfSymbol,
categoryShortcutName: shortcut.title,
categoryShortcutColor: shortcut.color)
.navigationLinkRouter(data: shortcut)
}
}
.padding(.horizontal, 16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ struct ListCategoryShortcutView: View {
categoryHeader

LazyVStack(spacing: 0) {
ForEach(data.shortcuts, id: \.self) { shortcut in
ForEach(viewModel.shortcuts, id: \.self) { shortcut in

ShortcutCell(shortcut: shortcut,
navigationParentView: self.data.navigationParentView)
.navigationLinkRouter(data: shortcut)
.listRowInsets(EdgeInsets())
.listRowSeparator(.hidden)
ShortcutCell(shortcut: shortcut, navigationParentView: .shortcuts)
.navigationLinkRouter(data: shortcut)
.listRowInsets(EdgeInsets())
.listRowSeparator(.hidden)
}
}
.padding(.bottom, 44)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ struct ListShortcutView: View {
ForEach(shortcuts, id: \.self) { shortcut in

ShortcutCell(shortcut: shortcut,
sectionType: data.sectionType,
navigationParentView: data.navigationParentView)
sectionType: viewModel.sectionType,
navigationParentView: .shortcuts)
.navigationLinkRouter(data: shortcut)

}
Expand Down

0 comments on commit 909dc74

Please sign in to comment.