Skip to content

Commit

Permalink
πŸ”€ :: (#423) Widget 닀크λͺ¨λ“œ λŒ€μ‘
Browse files Browse the repository at this point in the history
  • Loading branch information
rlarldud1234 authored Mar 13, 2023
2 parents bb9dd7d + 300d10c commit 261c59c
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 28 deletions.
74 changes: 53 additions & 21 deletions Application/Widget/Sources/Meal/XquareMealWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct XquareMealWidgetEntryView: View {
}

struct SmallXquareMealWidgetView: View {

@Environment(\.colorScheme) var colorScheme
let entry: XquareMealWidgetProvider.Entry
var mealMenu: MealMenuEntity?

Expand All @@ -99,29 +99,48 @@ struct SmallXquareMealWidgetView: View {
}

var body: some View {
VStack(alignment: .leading, spacing: 0) {
Text(entry.mealTime.rawValue)
.sdText(type: .body4, textColor: .GrayScale.gray900)
.padding(.trailing, 10)
.padding(.top, 3)
Text(entry.date.toString(format: .fullDate))
.sdText(type: .caption, textColor: .GrayScale.gray600)
.padding(.bottom, 10)
if mealMenu?.menu ?? [] != [""] {
Text("\(mealMenu?.menu?.joined(separator: ", ") ?? "") (\(mealMenu?.kcal ?? ""))")
.sdText(type: .caption, textColor: .GrayScale.gray900)
ZStack {
if colorScheme == .light {
Color.white.ignoresSafeArea()
} else {
Text("λ“±λ‘λœ 정보가 μ—†μŠ΅λ‹ˆλ‹€.")
.sdText(type: .caption, textColor: .GrayScale.gray900)
Color.GrayScale.gray900.ignoresSafeArea()
}
Spacer()
VStack(alignment: .leading, spacing: 0) {
Text(entry.mealTime.rawValue)
.sdText(
type: .body4,
textColor: colorScheme == .light ? .GrayScale.gray900 : .GrayScale.gray100
)
.padding(.trailing, 10)
.padding(.top, 3)
Text(entry.date.toString(format: .fullDate))
.sdText(
type: .caption,
textColor: colorScheme == .light ? .GrayScale.gray600 : .GrayScale.gray500
)
.padding(.bottom, 10)
if mealMenu?.menu ?? [] != [""] {
Text("\(mealMenu?.menu?.joined(separator: ", ") ?? "") (\(mealMenu?.kcal ?? ""))")
.sdText(
type: .caption,
textColor: colorScheme == .light ? .GrayScale.gray900 : .GrayScale.gray100
)
} else {
Text("λ“±λ‘λœ 정보가 μ—†μŠ΅λ‹ˆλ‹€.")
.sdText(
type: .caption,
textColor: colorScheme == .light ? .GrayScale.gray900 : .GrayScale.gray100
)
}
Spacer()
}
.padding(10)
}
.padding(10)
}
}

struct MediumXquareMealWidgetView: View {

@Environment(\.colorScheme) var colorScheme
let entry: XquareMealWidgetProvider.Entry
var mealMenu: MealMenuEntity?

Expand All @@ -136,23 +155,36 @@ struct MediumXquareMealWidgetView: View {
.frame(height: 10)
HStack(spacing: 0) {
Text(entry.mealTime.rawValue)
.sdText(type: .body4, textColor: .GrayScale.gray900)
.sdText(
type: .body4,
textColor: colorScheme == .light ? .GrayScale.gray900 : .GrayScale.gray100
)
.padding(.trailing, 10)
Text(entry.date.toString(format: .fullDate))
.sdText(type: .caption, textColor: .GrayScale.gray600)
.sdText(
type: .caption,
textColor: colorScheme == .light ? .GrayScale.gray600 : .GrayScale.gray500
)
Spacer()
}
.padding(.bottom, 10)
if mealMenu?.menu ?? [] != [""] {
Text("\(mealMenu?.menu?.joined(separator: ", ") ?? "") (\(mealMenu?.kcal ?? ""))")
.sdText(type: .caption, textColor: .GrayScale.gray900)
.sdText(
type: .caption,
textColor: colorScheme == .light ? .GrayScale.gray900 : .GrayScale.gray100
)
} else {
Text("λ“±λ‘λœ 정보가 μ—†μŠ΅λ‹ˆλ‹€.")
.sdText(type: .caption, textColor: .GrayScale.gray900)
.sdText(
type: .caption,
textColor: colorScheme == .light ? .GrayScale.gray900 : .GrayScale.gray100
)
}
Spacer()
}
.padding(24)
.background(colorScheme == .light ? .white : .GrayScale.gray900)
}
}
struct XquareMealWidget: Widget {
Expand Down
21 changes: 16 additions & 5 deletions Application/Widget/Sources/Schedule/ScheduleWidgetCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@ import SwiftUI
import SemicolonDesign

struct ScheduleWidgetCell: View {
@Environment(\.colorScheme) var colorScheme
let schedule: String

var body: some View {
HStack(spacing: 0) {
Color.Primary.purple400
.frame(width: 4, height: 27)
.cornerRadius(4)
.padding(.trailing, 2)
if colorScheme == .light {
Color.Primary.purple400
.frame(width: 4, height: 27)
.cornerRadius(4)
.padding(.trailing, 2)
} else {
Color.Primary.purple900
.frame(width: 4, height: 27)
.cornerRadius(4)
.padding(.trailing, 2)
}
HStack {
Text(schedule)
.sdText(type: .caption, textColor: .Primary.purple400)
.sdText(
type: .caption,
textColor: colorScheme == .light ? .Primary.purple400 : .Primary.purple900
)
.padding(.leading, 10)
Spacer()
}
Expand Down
12 changes: 10 additions & 2 deletions Application/Widget/Sources/Schedule/XquareScheduleWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,21 @@ struct ScheduleEntry: TimelineEntry {
}

struct XquareScheduleWidgetEntryView: View {
@Environment(\.colorScheme) var colorScheme
var entry: XquareScheduleWidgetProvider.Entry

var body: some View {
VStack(alignment: .leading, spacing: 0) {
Text(entry.date.toString(format: "Eμš”μΌ"))
.sdText(type: .caption, textColor: .black)
.sdText(
type: .caption,
textColor: colorScheme == .light ? .black : .white
)
Text(entry.date.toString(format: "dd일"))
.sdText(type: .heading4, textColor: .black)
.sdText(
type: .heading4,
textColor: colorScheme == .light ? .black : .white
)
.padding(.bottom, 5)
if entry.schedule != [] {
ForEach(entry.schedule, id: \.id) { schedule in
Expand All @@ -79,6 +86,7 @@ struct XquareScheduleWidgetEntryView: View {
Spacer()
}
.padding([.top, .leading], 16)
.background(colorScheme == .light ? .white : .GrayScale.gray900)
}
}

Expand Down

0 comments on commit 261c59c

Please sign in to comment.