-
Notifications
You must be signed in to change notification settings - Fork 0
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
56 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
Gongbaek_iOS/Gongbaek_iOS/Global/Component/Box/TimeBox.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,56 @@ | ||
// | ||
// TimeBox.swift | ||
// Gongbaek_iOS | ||
// | ||
// Created by 김민서 on 1/16/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
enum InfoColorState { | ||
case gray | ||
case white | ||
} | ||
|
||
struct TimeBox: View { | ||
let state: InfoColorState | ||
let text: String | ||
let font: Font | ||
|
||
var body: some View { | ||
HStack(alignment: .center, spacing: 4) { | ||
Image(.icTime16) | ||
.resizable() | ||
.frame(width: 16, height: 16) | ||
.foregroundColor(iconColor) | ||
|
||
Text(text) | ||
.font(font) | ||
.foregroundColor(textColor) | ||
} | ||
} | ||
|
||
private var iconColor: Color { | ||
switch state { | ||
case .gray: | ||
return .gray05 | ||
case .white: | ||
return .grayWhite | ||
} | ||
} | ||
|
||
private var textColor: Color { | ||
switch state { | ||
case .gray: | ||
return .gray06 | ||
case .white: | ||
return .grayWhite | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
#Preview { | ||
TimeBox(state: .gray, text: "몇시일까용?", font: .pretendard(.caption2_r_12)) | ||
} |