-
Notifications
You must be signed in to change notification settings - Fork 2
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 #115 from Team-B1ND/feature/dds
Apply new MealView design
- Loading branch information
Showing
12 changed files
with
439 additions
and
175 deletions.
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
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,26 @@ | ||
// | ||
// MealType.swift | ||
// Domain | ||
// | ||
// Created by hhhello0507 on 8/12/24. | ||
// | ||
|
||
import Foundation | ||
import SwiftBok | ||
|
||
public enum MealType: Int, RawRepresentable { | ||
case breakfast | ||
case lunch | ||
case dinner | ||
|
||
public var label: String { | ||
switch self { | ||
case .breakfast: | ||
"아침" | ||
case .lunch: | ||
"점심" | ||
case .dinner: | ||
"저녁" | ||
} | ||
} | ||
} |
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,51 @@ | ||
// | ||
// CalendarCell.swift | ||
// Feature | ||
// | ||
// Created by hhhello0507 on 8/12/24. | ||
// | ||
|
||
import SwiftUI | ||
import DDS | ||
|
||
struct CalendarDateCell: View { | ||
|
||
private let date: Date? | ||
private let selected: Bool | ||
|
||
init(date: Date?, selected: Bool) { | ||
self.date = date | ||
self.selected = selected | ||
} | ||
|
||
private var label: String { | ||
guard let date else { | ||
return "" | ||
} | ||
guard let day = date[.day] else { | ||
return "" | ||
} | ||
return "\(day)" | ||
} | ||
|
||
var body: some View { | ||
Text(label) | ||
.headline(.medium) | ||
.foreground( | ||
selected | ||
? DodamColor.Static.white | ||
: DodamColor.Label.alternative | ||
) | ||
.padding(.vertical, 8) | ||
.if(selected) { view in | ||
view.background { | ||
Rectangle() | ||
.dodamFill(DodamColor.Primary.normal) | ||
.clipShape(.medium) | ||
.frame(width: 36, height: 36) | ||
} | ||
} | ||
.frame(maxWidth: .infinity) | ||
.opacity(date == nil ? 0 : 1) | ||
} | ||
} |
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 @@ | ||
// | ||
// MealCell.swift | ||
// Feature | ||
// | ||
// Created by hhhello0507 on 8/12/24. | ||
// | ||
|
||
import SwiftUI | ||
import DDS | ||
import Domain | ||
|
||
struct MealCell: View { | ||
|
||
private let type: MealType | ||
private let meal: Meal | ||
|
||
init(type: MealType, meal: Meal) { | ||
self.type = type | ||
self.meal = meal | ||
} | ||
|
||
var body: some View { | ||
VStack(spacing: 12) { | ||
HStack { | ||
DodamTag(type.label, type: .primary) | ||
Spacer() | ||
Text("\(Int(meal.calorie))Kcal") | ||
.label(.medium) | ||
.foreground(DodamColor.Label.alternative) | ||
} | ||
Text(meal.details.map { $0.name }.joined(separator: "\n")) | ||
.body1(.medium) | ||
.foreground(DodamColor.Label.normal) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
} | ||
.padding(16) | ||
.background(DodamColor.Background.normal) | ||
.clipShape(.large) | ||
} | ||
} |
Oops, something went wrong.