-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from School-of-Company/62-ExpoEdit-Publishing
🔀 :: [#62] 박람회 수정 퍼블리싱
- Loading branch information
Showing
17 changed files
with
588 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
## 💡 개요 | ||
### | ||
|
||
## 📃 작업내용 | ||
|
||
|
21 changes: 21 additions & 0 deletions
21
Projects/App/Resources/Assets.xcassets/grayXButton.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "grayXButton.svg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
Projects/App/Resources/Assets.xcassets/grayXButton.imageset/grayXButton.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
Projects/App/Resources/Assets.xcassets/location.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "location.svg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
Projects/App/Resources/Assets.xcassets/location.imageset/location.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
Projects/App/Resources/Assets.xcassets/photoImage.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "photoImage.svg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
Projects/App/Resources/Assets.xcassets/photoImage.imageset/photoImage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
Projects/App/Resources/Assets.xcassets/photoget.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "photoget.svg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Projects/App/Resources/Assets.xcassets/photoget.imageset/photoget.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
Projects/App/Resources/Assets.xcassets/plusBlue.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "plusBlue.svg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
Projects/App/Resources/Assets.xcassets/plusBlue.imageset/plusBlue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
Projects/App/Resources/Assets.xcassets/warning.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "warning.svg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
Projects/App/Resources/Assets.xcassets/warning.imageset/warning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
106 changes: 106 additions & 0 deletions
106
Projects/App/Sources/DesignSystem/TextField/ExpoTextEditor.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,106 @@ | ||
// | ||
// ExpoTextEditor.swift | ||
// Expo-iOS | ||
// | ||
// Created by 서지완 on 11/14/24. | ||
// Copyright © 2024 SchoolofCompany. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ExpoTextEditor: View { | ||
@Binding var text: String | ||
@FocusState private var isFocused: Bool | ||
var title: String | ||
var placeholder: String | ||
var errorText: String | ||
var isError: Bool | ||
var onSubmit: () -> Void | ||
|
||
private var borderColor: Color { | ||
isError ? ExpoColor.error.swiftUIColor : ExpoColor.gray300.swiftUIColor | ||
} | ||
|
||
@State private var dynamicHeight: CGFloat = 50 // Default height for the first line | ||
|
||
public init( | ||
_ placeholder: String = "", | ||
text: Binding<String>, | ||
title: String = "", | ||
errorText: String = "", | ||
isError: Bool = false, | ||
onSubmit: @escaping () -> Void = {} | ||
) { | ||
self._text = text | ||
self.placeholder = placeholder | ||
self.title = title | ||
self.errorText = errorText | ||
self.isError = isError | ||
self.onSubmit = onSubmit | ||
} | ||
|
||
var body: some View { | ||
VStack(alignment: .leading, spacing: 4) { | ||
if !title.isEmpty { | ||
Text(title) | ||
.expoFont(.body2B) | ||
.expoColor(ExpoColor.black) | ||
} | ||
|
||
ZStack(alignment: .topLeading) { | ||
TextEditor(text: $text) | ||
.padding(.horizontal, 16) | ||
.padding(.top, 4) | ||
.expoFont(.caption1R) | ||
.frame(height: dynamicHeight) // Initial height is fixed at 50 | ||
.onChange(of: text) { newValue in | ||
// Adjust height dynamically once the content grows | ||
if newValue.count > 0 { | ||
self.dynamicHeight = self.calculateHeight(for: newValue) | ||
} | ||
} | ||
.onSubmit(onSubmit) | ||
.focused($isFocused) | ||
.overlay { | ||
RoundedRectangle(cornerRadius: 8) | ||
.strokeBorder(borderColor) | ||
} | ||
.cornerRadius(8) | ||
.onTapGesture { | ||
isFocused = true | ||
} | ||
|
||
if text.isEmpty { | ||
Text(placeholder) | ||
.expoFont(.caption1R) | ||
.expoColor(ExpoColor.gray300) | ||
.padding(.top, 14) | ||
.padding(.leading, 20) | ||
} | ||
} | ||
|
||
if isError { | ||
Text(errorText) | ||
.expoColor(ExpoColor.error) | ||
.expoFont(.caption2R) | ||
} | ||
} | ||
.padding(.horizontal, 16) | ||
} | ||
|
||
private func calculateHeight(for text: String) -> CGFloat { | ||
let width = UIScreen.main.bounds.width - 40 // Adjust for padding | ||
let font = UIFont.systemFont(ofSize: 17) // Set the font to match your text style | ||
let attributes = [NSAttributedString.Key.font: font] | ||
|
||
let boundingRect = NSString(string: text).boundingRect( | ||
with: CGSize(width: width, height: .infinity), | ||
options: .usesLineFragmentOrigin, | ||
attributes: attributes, | ||
context: nil | ||
) | ||
|
||
// Return height based on content, but no less than 50 | ||
return max(50, boundingRect.height + 20) // Ensure a minimum height of 50 | ||
} | ||
} |
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,42 @@ | ||
// | ||
// ImagePicker.swift | ||
// Expo-iOS | ||
// | ||
// Created by 서지완 on 11/14/24. | ||
// Copyright © 2024 SchoolofCompany. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
struct ImagePicker: UIViewControllerRepresentable { | ||
@Binding var selectedImage: UIImage? | ||
@Environment(\.presentationMode) private var presentationMode | ||
|
||
func makeUIViewController(context: UIViewControllerRepresentableContext<ImagePicker>) -> UIImagePickerController { | ||
let picker = UIImagePickerController() | ||
picker.delegate = context.coordinator | ||
return picker | ||
} | ||
|
||
func updateUIViewController(_ uiViewController: UIImagePickerController, context: UIViewControllerRepresentableContext<ImagePicker>) {} | ||
|
||
func makeCoordinator() -> Coordinator { | ||
Coordinator(self) | ||
} | ||
|
||
class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate { | ||
let parent: ImagePicker | ||
|
||
init(_ parent: ImagePicker) { | ||
self.parent = parent | ||
} | ||
|
||
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { | ||
if let image = info[.originalImage] as? UIImage { | ||
parent.selectedImage = image | ||
} | ||
parent.presentationMode.wrappedValue.dismiss() | ||
} | ||
} | ||
} |
Oops, something went wrong.