-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/446 gridlines #559
Changes from 5 commits
381a11e
980e3ec
7324704
789657d
7df2ad7
f9a249a
573c806
db6052e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,7 @@ struct TimetableGridView: View { | |
let rooms = RoomType.allCases.filter {$0 != RoomType.roomIj} | ||
|
||
ScrollView([.horizontal, .vertical]) { | ||
Grid { | ||
Grid(alignment: .leading, horizontalSpacing: 4, verticalSpacing: 2) { | ||
GridRow { | ||
Color.clear | ||
.gridCellUnsizedAxes([.horizontal, .vertical]) | ||
|
@@ -128,18 +128,19 @@ struct TimetableGridView: View { | |
let room = column.toRoom() | ||
Text(room.name.currentLangTitle).foregroundStyle(room.roomTheme.primaryColor) | ||
.frame(width: 192) | ||
|
||
} | ||
} | ||
DashedDivider(axis: .horizontal) | ||
ForEach(store.timetableItems, id: \.self) { timeBlock in | ||
GridRow { | ||
VStack { | ||
Text(timeBlock.startsTimeString).foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) | ||
Spacer() | ||
|
||
}.frame(height: 153) | ||
|
||
ForEach(rooms, id: \.self) { room in | ||
|
||
if let cell = timeBlock.getCellForRoom(room: room, onTap: { item in | ||
store.send(.view(.timetableItemTapped(item)))}) { | ||
cell | ||
|
@@ -152,8 +153,9 @@ struct TimetableGridView: View { | |
} | ||
} | ||
} | ||
DashedDivider(axis: .horizontal) | ||
} | ||
} | ||
}.fixedSize(horizontal: false, vertical: true) | ||
.padding(.trailing) | ||
|
||
bottomTabBarPadding | ||
|
@@ -192,6 +194,39 @@ struct TimeGroupMiniList: View { | |
} | ||
} | ||
|
||
struct DashedDivider: View { | ||
public var axis: Axis | ||
|
||
var body: some View { | ||
let shape = LineShape(axis: axis) | ||
.stroke(style: .init(dash: [2])) | ||
.foregroundStyle(AssetColors.Outline.outlineVariant.swiftUIColor) | ||
if axis == .horizontal { | ||
shape.frame(height: 1) | ||
} else { | ||
shape.frame(width: 1).padding(0) | ||
} | ||
//shape | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this comment🤔? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed |
||
} | ||
} | ||
|
||
struct LineShape: Shape { | ||
public var axis: Axis | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this property is 'let' more than better👍 |
||
|
||
func path(in rect: CGRect) -> Path { | ||
var path = Path() | ||
path.move(to: CGPoint(x: 0, y: 0)) | ||
|
||
if axis == .horizontal { | ||
path.addLine(to: CGPoint(x: rect.width, y: 0)) | ||
} else { | ||
path.addLine(to: CGPoint(x: 0, y: rect.height)) | ||
} | ||
|
||
return path | ||
} | ||
} | ||
|
||
fileprivate var bottomTabBarPadding: some View { | ||
// bottom floating tabbar padding | ||
Color.clear.padding(.bottom, 60) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this property is 'let' more than better👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should change here too🙏