Skip to content

Commit

Permalink
💄 Implement Product sorter view
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteHyun committed Jan 28, 2024
1 parent 78c67d8 commit ce0d986
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
4 changes: 4 additions & 0 deletions PyeonHaeng-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
BAB569612B639F3000D1E0F9 /* DesignSystem in Frameworks */ = {isa = PBXBuildFile; productRef = BAB569602B639F3000D1E0F9 /* DesignSystem */; };
BAE159D82B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE159D72B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift */; };
BAE159DA2B65FC35002DCF94 /* HomeProductListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE159D92B65FC35002DCF94 /* HomeProductListView.swift */; };
BAE159DE2B663A9A002DCF94 /* HomeProductSorterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */; };
BAF2BEB32B61236100931AF0 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = BAF2BEB22B61236100931AF0 /* Localizable.xcstrings */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -77,6 +78,7 @@
BABFEA6F2B6399C30084C0EC /* Shared */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Shared; sourceTree = "<group>"; };
BAE159D72B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeProductDetailSelectionView.swift; sourceTree = "<group>"; };
BAE159D92B65FC35002DCF94 /* HomeProductListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeProductListView.swift; sourceTree = "<group>"; };
BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeProductSorterView.swift; sourceTree = "<group>"; };
BAF2BEB22B61236100931AF0 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -179,6 +181,7 @@
isa = PBXGroup;
children = (
BA28F1872B6155910052855E /* HomeView.swift */,
BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */,
BAE159D72B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift */,
BAE159D92B65FC35002DCF94 /* HomeProductListView.swift */,
);
Expand Down Expand Up @@ -444,6 +447,7 @@
BA28F18B2B6155BD0052855E /* ProductInfoView.swift in Sources */,
BA28F1912B61566E0052855E /* ProductSearchView.swift in Sources */,
BA28F18E2B6156420052855E /* SettingsView.swift in Sources */,
BAE159DE2B663A9A002DCF94 /* HomeProductSorterView.swift in Sources */,
BAE159D82B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift in Sources */,
BAA4D9AF2B5A1795005999F8 /* SplashView.swift in Sources */,
BAA4D9AD2B5A1795005999F8 /* PyeonHaengApp.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// HomeProductSorterView.swift
// PyeonHaeng-iOS
//
// Created by 홍승현 on 1/28/24.
//

import SwiftUI

struct HomeProductSorterView: View {
private let count: Int

init(count: Int) {
self.count = count
}

var body: some View {
HStack {
Text(attributedString)
.font(.title2)
Spacer()
Button {} label: {
Image(systemName: "arrow.up.arrow.down")
}
}
.padding(.all, 8)
}

var attributedString: AttributedString {
var string = AttributedString("\(count)개의 상품이 있어요!")

if let range = string.range(of: "\(count)") {
string[range].foregroundColor = .green500
}

return string
}
}

#Preview {
HomeProductSorterView(count: 50)
}
2 changes: 1 addition & 1 deletion PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ struct HomeView: View {
NavigationStack {
VStack {
HomeProductDetailSelectionView()
HomeProductSorterView(count: 12)
HomeProductListView()
Spacer()
}
.padding(.horizontal, Metrics.horizontal)
.navigationBarTitleDisplayMode(.inline)
Expand Down

0 comments on commit ce0d986

Please sign in to comment.