-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 검색 화면 구현 #33
Merged
Merged
feat: 검색 화면 구현 #33
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// HotKeyword.swift | ||
// PPACModels | ||
// | ||
// Created by 리나 on 2024/06/29. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct HotKeyword: Hashable { | ||
|
||
// MARK: - Properties | ||
|
||
public let title: String | ||
public let imageUrlString: String | ||
|
||
// MARK: - Initializers | ||
|
||
public init( | ||
title: String, | ||
imageUrlString: String | ||
) { | ||
self.title = title | ||
self.imageUrlString = imageUrlString | ||
} | ||
} | ||
|
||
public extension HotKeyword { | ||
static let mock1 = HotKeyword( | ||
title: "띠용오오우어어우어엉?", | ||
imageUrlString: "https://www.blockmedia.co.kr/wp-content/uploads/2024/05/%EB%8F%84%EC%A7%80%EC%BD%94%EC%9D%B8Doge-%EC%B9%B4%EB%B6%80%EC%88%98.png" | ||
) | ||
|
||
static let mock2 = HotKeyword( | ||
title: "짜란다짜란다", | ||
imageUrlString: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR_xO_sgszdvyVBp8xz4B82kHmyyO0SNZO-4A&s" | ||
) | ||
|
||
static let mock3 = HotKeyword( | ||
title: "후회", | ||
imageUrlString: "https://s3.ap-northeast-2.amazonaws.com/univ-careet/FileData/Picture/202310/3e7e0445-3812-4c06-bc75-a1bed40a3332_770x426.png" | ||
) | ||
|
||
static let mock4 = HotKeyword( | ||
title: "무한도전", | ||
imageUrlString: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQBnKb96Uc-894Fhgt_5xLsCvY0pSkCl0B4TA&s" | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// MimCategory.swift | ||
// PPACModels | ||
// | ||
// Created by 리나 on 2024/06/29. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct MimCategory: Hashable { | ||
public let title: String | ||
public let categories: [String] | ||
|
||
public init(title: String, categories: [String]) { | ||
self.title = title | ||
self.categories = categories | ||
} | ||
} | ||
|
||
public extension MimCategory { | ||
static let mock1 = MimCategory( | ||
title: "감정", | ||
categories: ["행복", "슬픈", "무념무상", "분노", "웃긴", "피곤", "절망", "현타", "당황"] | ||
) | ||
static let mock2 = MimCategory( | ||
title: "상황", | ||
categories: ["회사", "대학", "공부", "연애", "긁", "다이어트", "주식", "고민", "축하", "칭찬"] | ||
) | ||
static let mock3 = MimCategory( | ||
title: "컨텐츠", | ||
categories: ["동물", "무한도전", "캐릭터", "짱구", "문상훈", "검정고무신", "그 외"] | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// FakeSearchBar.swift | ||
// DesignSystem | ||
// | ||
// Created by 리나 on 2024/06/29. | ||
// | ||
|
||
import SwiftUI | ||
import ResourceKit | ||
|
||
struct FakeSearchBar: View { | ||
let placeHolder: String | ||
|
||
init(placeHolder: String) { | ||
self.placeHolder = placeHolder | ||
} | ||
|
||
var body: some View { | ||
fakeTextField | ||
.frame(maxWidth: .infinity) | ||
.frame(height: 44) | ||
.background(Color.Background.assistive) | ||
.clipShape(RoundedRectangle(cornerRadius: 10)) | ||
.padding(.horizontal, 20) | ||
.padding(.vertical, 16) | ||
} | ||
|
||
private var fakeTextField: some View { | ||
HStack(spacing: 12) { | ||
ResourceKitAsset.Icon.search.swiftUIImage | ||
|
||
Text(placeHolder) | ||
.font(Font.Body.Large.medium) | ||
.foregroundColor(Color.Text.tertiary) | ||
|
||
Spacer() | ||
} | ||
.padding(.horizontal, 16) | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
Projects/Features/Search/Sources/View/HotKeywordImageView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// HotKeywordImageView.swift | ||
// Search | ||
// | ||
// Created by 리나 on 2024/06/30. | ||
// | ||
|
||
import SwiftUI | ||
import Kingfisher | ||
import PPACModels | ||
import DesignSystem | ||
import ResourceKit | ||
|
||
struct HotKeywordImageView: View, HorizontalMimItemViewProtocol { | ||
typealias Item = HotKeyword | ||
|
||
let hotKeyword: HotKeyword | ||
|
||
init(item hotKeyword: HotKeyword) { | ||
self.hotKeyword = hotKeyword | ||
} | ||
|
||
var body: some View { | ||
ZStack { | ||
imageView | ||
|
||
Color.black.opacity(0.4) | ||
|
||
keywordView | ||
} | ||
.overlay( | ||
RoundedRectangle(cornerRadius: 10) | ||
.inset(by: 1) | ||
.stroke(Color.Border.primary, lineWidth: 2) | ||
) | ||
.clipShape(RoundedRectangle(cornerRadius: 10)) | ||
} | ||
|
||
private var imageView: some View { | ||
KFImage(URL(string: hotKeyword.imageUrlString)) | ||
.resizable() | ||
.loadDiskFileSynchronously() | ||
.cacheMemoryOnly() | ||
.frame(width: 90, height: 90) | ||
.aspectRatio(contentMode: .fit) | ||
} | ||
|
||
private var keywordView: some View { | ||
Text(hotKeyword.title) | ||
.font(Font.Body.Large.semiBold) | ||
.foregroundColor(Color.Text.inverse) | ||
.lineLimit(2) | ||
.multilineTextAlignment(.center) | ||
.padding(.horizontal, 16) | ||
.frame(width: 90, height: 90) | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
Projects/Features/Search/Sources/View/SearchPreparingAlert.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// SearchPreparingAlert.swift | ||
// Search | ||
// | ||
// Created by 리나 on 2024/06/30. | ||
// | ||
|
||
import SwiftUI | ||
import ResourceKit | ||
|
||
struct SearchPreparingAlert: View { | ||
private var dismiss: (() -> Void) | ||
|
||
init(dismiss: @escaping (() -> Void)) { | ||
self.dismiss = dismiss | ||
} | ||
|
||
var body: some View { | ||
VStack(spacing: 0) { | ||
title | ||
|
||
description | ||
.padding(.top, 8) | ||
|
||
confirmButton | ||
.padding(.top, 14) | ||
} | ||
.padding(.horizontal, 30) | ||
.padding(.vertical, 20) | ||
.background(Color.Background.white) | ||
.cornerRadius(20) | ||
} | ||
|
||
|
||
private var title: some View { | ||
HStack { | ||
Text("조금만 기다려주세요!") | ||
.font(Font.Heading.Medium.semiBold) | ||
.foregroundColor(Color.Text.primary) | ||
.foregroundColor(.black) | ||
Spacer() | ||
} | ||
} | ||
|
||
private var description: some View { | ||
HStack { | ||
Text("검색은 준비 중이에요.") | ||
.font(Font.Body.Large.medium) | ||
.foregroundColor(Color.Text.secondary) | ||
.multilineTextAlignment(.leading) | ||
Spacer() | ||
} | ||
} | ||
|
||
private var confirmButton: some View { | ||
HStack{ | ||
Spacer() | ||
Button { | ||
dismiss() | ||
} label: { | ||
Text("확인") | ||
.font(Font.Body.Large.medium) | ||
.foregroundColor(Color.Text.brand) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 2 additions & 13 deletions
15
Projects/ResourceKit/Resources/Icon.xcassets/Search.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Search.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
"filename" : "Search.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
|
Binary file removed
BIN
-649 Bytes
Projects/ResourceKit/Resources/Icon.xcassets/Search.imageset/Search.png
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이번 PR에 HorizontalMimItemViewProtocol 요거 같이 안올라온거 같은데 맞나용??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
덕분에 해결했어요! 감삼다!