-
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.
Browse files
Browse the repository at this point in the history
[#17] [iOS] [UI] As a user, I can see Survey selection page
- Loading branch information
Showing
22 changed files
with
681 additions
and
67 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
Large diffs are not rendered by default.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
iosApp/Survey/Resources/Assets/Assets.xcassets/NextButton.imageset/Contents.json
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,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "nextButton.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
Binary file added
BIN
+1.5 KB
iosApp/Survey/Resources/Assets/Assets.xcassets/NextButton.imageset/nextButton.pdf
Binary file not shown.
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
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 |
---|---|---|
|
@@ -11,4 +11,5 @@ enum Screen { | |
case login | ||
case splash | ||
case resetPassword | ||
case surveySelection | ||
} |
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
60 changes: 60 additions & 0 deletions
60
iosApp/Survey/Sources/Presentation/Modules/SurveySelection/SurveyItemView.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,60 @@ | ||
// | ||
// SurveyItemView.swift | ||
// Survey | ||
// | ||
// Created by Bliss on 28/9/22. | ||
// Copyright © 2022 Nimble. All rights reserved. | ||
// | ||
|
||
import Kingfisher | ||
import Shared | ||
import SwiftUI | ||
|
||
struct SurveyItemView: View { | ||
|
||
let survey: SurveyUiModel | ||
|
||
var body: some View { | ||
ZStack { | ||
GeometryReader { geo in | ||
KFImage(survey.largeImageUrl.asURL) | ||
.resizable() | ||
.scaledToFill() | ||
.frame(maxWidth: geo.size.width, maxHeight: geo.size.height) | ||
.clipped() | ||
.accessibility(.surveySelection(.mainImage)) | ||
} | ||
.ignoresSafeArea() | ||
|
||
Rectangle() | ||
.foregroundColor(.clear) | ||
.background( | ||
LinearGradient(colors: [.clear, .black], startPoint: .top, endPoint: .bottom) | ||
) | ||
.opacity(0.6) | ||
.ignoresSafeArea() | ||
|
||
GeometryReader { geo in | ||
let titleOffset = geo.size.height - 160.0 | ||
Text(survey.title) | ||
.font(.boldTitle) | ||
.lineLimit(2) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
.offset(y: titleOffset) | ||
.accessibility(.surveySelection(.titleText)) | ||
|
||
let descriptionOffset = geo.size.height - 76.0 | ||
Text(survey.description_) | ||
.font(.regularBody) | ||
.lineLimit(2) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
.offset(y: descriptionOffset) | ||
.accessibility(.surveySelection(.detailText)) | ||
} | ||
.id(survey.id) | ||
.padding(.leading, 20.0) | ||
.padding(.trailing, 76.0) | ||
} | ||
.accessibilityElement(children: .contain) | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
iosApp/Survey/Sources/Presentation/Modules/SurveySelection/SurveySelectionView.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,86 @@ | ||
// | ||
// SurveySelectionView.swift | ||
// Survey | ||
// | ||
// Created by Bliss on 28/9/22. | ||
// Copyright © 2022 Nimble. All rights reserved. | ||
// | ||
|
||
import Shared | ||
import SwiftUI | ||
|
||
struct SurveySelectionView: View { | ||
|
||
@State private var currentPage = 0 | ||
// TODO: Replace Example data | ||
@State private var surveys: [SurveyUiModel] = [ | ||
SurveyUiModel( | ||
id: "1", | ||
imageUrl: "https://dhdbhh0jsld0o.cloudfront.net/m/1ea51560991bcb7d00d0_", | ||
title: "Scarlett Bangkok", | ||
description: "We'd love ot hear from you!" | ||
), | ||
SurveyUiModel( | ||
id: "2", | ||
imageUrl: "https://dhdbhh0jsld0o.cloudfront.net/m/287db81c5e4242412cc0_", | ||
title: "ibis Bangkok Riverside", | ||
description: "We'd love ot hear from you!" | ||
), | ||
SurveyUiModel( | ||
id: "3", | ||
imageUrl: "https://dhdbhh0jsld0o.cloudfront.net/m/1ea51560991bcb7d00d0_", | ||
title: "Scarlett Bangkok", | ||
description: "We'd love ot hear from you!" | ||
) | ||
] | ||
|
||
var body: some View { | ||
ZStack { | ||
FadePaginationView( | ||
currentPage: $currentPage, | ||
currentView: { item in | ||
AnyView(SurveyItemView(survey: item)) | ||
}, | ||
nextView: { item in | ||
AnyView(SurveyItemView(survey: item)) | ||
}, | ||
items: surveys | ||
) | ||
.onChange(of: currentPage) { newValue in | ||
// TODO: Update viewModel to new index | ||
print(newValue) | ||
} | ||
VStack(alignment: .leading) { | ||
Spacer() | ||
HStack(alignment: .bottom) { | ||
PageControlView(currentPage: $currentPage, numberOfPages: surveys.count) | ||
.frame(width: .zero, alignment: .leading) | ||
Spacer() | ||
} | ||
Spacer() | ||
.frame(height: 190.0) | ||
} | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
|
||
VStack { | ||
Spacer() | ||
HStack { | ||
Spacer() | ||
Button { | ||
// TODO: Add action when press next | ||
} label: { | ||
Assets.nextButton | ||
.image | ||
.resizable() | ||
.frame(width: 56.0, height: 56.0) | ||
} | ||
.padding(.trailing, 20.0) | ||
.padding(.bottom, 26.0) | ||
.accessibility(.surveySelection(.nextButton)) | ||
} | ||
} | ||
} | ||
.accessibilityElement(children: .contain) | ||
.accessibility(.surveySelection(.view)) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
iosApp/Survey/Sources/Presentation/ViewId/ViewId+SurveySelection.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,19 @@ | ||
// | ||
// ViewId+SurveySelection.swift | ||
// Survey | ||
// | ||
// Created by Bliss on 28/9/22. | ||
// Copyright © 2022 Nimble. All rights reserved. | ||
// | ||
|
||
extension ViewId { | ||
|
||
enum SurveySelection: String { | ||
|
||
case view = "survey.selection.view" | ||
case nextButton = "survey.selection.next.button" | ||
case titleText = "survey.selection.title.text" | ||
case detailText = "survey.selection.detail.text" | ||
case mainImage = "survey.selection.main.image" | ||
} | ||
} |
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
Oops, something went wrong.