-
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.
[Feat] #241 - RandomTopicSwiftUI View 구현 및 데이터 바인딩
- Loading branch information
1 parent
d6b6a33
commit 9ffc1be
Showing
2 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
Smeem-iOS/Smeem-iOS/Global/UIComponents/SwiftUI/RandomTopicViewSwiftUI.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,45 @@ | ||
// | ||
// RandomTopicViewSwiftUI.swift | ||
// Smeem-iOS | ||
// | ||
// Created by Joon Baek on 12/11/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct RandomTopicViewSwiftUI: View { | ||
|
||
// MARK: - Properties | ||
|
||
var contentText: String? | ||
|
||
// MARK: - Body | ||
|
||
var body: some View { | ||
GeometryReader { geometry in | ||
HStack(alignment: .firstTextBaseline, spacing: 3) { | ||
Text("Q.") | ||
.font(Font(UIFont.b1)) | ||
.foregroundColor(Color(UIColor.point)) | ||
.padding(.leading, 18.scaledByWidth()) | ||
|
||
Text(contentText ?? "") | ||
.font(Font(UIFont.b4)) | ||
.foregroundColor(Color(UIColor.smeemBlack)) | ||
.lineLimit(2) | ||
.fixedSize(horizontal: false, vertical: true) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
.padding(.trailing, 30.scaledByWidth()) | ||
} | ||
.padding(.top, 20.scaledByHeight()) | ||
.padding(.bottom, 20.scaledByHeight()) | ||
.background(Color(UIColor.gray100)) | ||
} | ||
.frame(height: contentText?.count ?? 0 > 20 ? 84.scaledByHeight() : 62.scaledByHeight()) | ||
} | ||
} | ||
|
||
#Preview { | ||
var text: String = "랜덤주제 한줄일 경우 " | ||
RandomTopicViewSwiftUI(contentText: text) | ||
} |
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