-
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.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
SUWIKI/SUWIKI/Presentation/LectureEvaluation/Detail/EvaluateCell.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,61 @@ | ||
// | ||
// EvaluateCell.swift | ||
// SUWIKI | ||
// | ||
// Created by νμ§μ on 2/29/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct EvaluateCell: View { | ||
|
||
var semester: String | ||
var totalAvg: Double | ||
var content: String | ||
|
||
var body: some View { | ||
VStack(alignment: .leading, spacing: 0) { | ||
semesterLabel | ||
.padding(.top, 12) | ||
.padding(.bottom, 14) | ||
avarageStar | ||
.padding(.bottom, 14) | ||
postContent | ||
.padding(.bottom, 12) | ||
} | ||
.padding(.horizontal, 12) | ||
.background(Color.white) | ||
} | ||
|
||
var semesterLabel: some View { | ||
HStack { | ||
RoundedRectangle(cornerRadius: 10) | ||
.frame(width: 50, height: 21) | ||
.foregroundStyle(Color(uiColor: .grayF6)) | ||
.overlay { | ||
Text(semester) | ||
.font(.c4) | ||
.foregroundStyle(Color(uiColor: .gray6A)) | ||
} | ||
Spacer() | ||
} | ||
|
||
} | ||
|
||
var avarageStar: some View { | ||
Stars(avarage: totalAvg, | ||
width: 12, | ||
height: 12) | ||
} | ||
|
||
var postContent: some View { | ||
Text(content) | ||
.font(.b7) | ||
.lineSpacing(2) | ||
.truncationMode(.tail) | ||
} | ||
} | ||
|
||
#Preview { | ||
EvaluateCell(semester: "2022-2", totalAvg: 3.5, content: "κ±°μ ν νκΈ° νννμλλ°...νμ μ λ§λλ©΄ μ λͺ¨λ₯΄κ² λ€μ.κ΅μ₯ν μ€κ±°μ ν νκΈ° νννμλλ°...νμ μ λ§λλ©΄ μ λͺ¨λ₯΄κ² λ€μ.κ΅μ₯νμ€ν λ§μΈλμκΈ΄ν΄μ.\nμ μ΄ κ΅μλ μ μνκΈ° νλ€μμ΄μ.\nκ΅μ₯ν μ€ν λ§μΈλμκΈ΄ν΄μ.\nμ μ΄ κ΅μλ μ μνκΈ° νλ€μμ΄μ.") | ||
} |