Created
August 3, 2021 18:17
-
-
Save MarcoEidinger/987f305aeb54170d8c7bc166637cb06f to your computer and use it in GitHub Desktop.
SwiftUI Preview for ObjectMessageView in https://github.com/SAP/cloud-sdk-ios-cai
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
// ... | |
#if DEBUG | |
struct ObjectMessageView_Previews: PreviewProvider { | |
static var singleButtonPreview: some View { | |
ObjectMessageView(model: UIModelDataContent(text: "text1", list: nil, form: nil, picture: nil, video: nil, | |
header: UIModelDataHeader(title: UIModelDataValue(value: "A very long title which is maybe even too long but who knows :) who can really tell? I don't know. That is a real interesting question. What do you think?", dataType: UIModelData.ValueType.text.rawValue, rawValue: nil, | |
label: nil, | |
valueState: nil), | |
subtitle: UIModelDataValue(value: "A very long subtitle which is maybe even too long but who knows :) who can really tell? I don't know. That is a real interesting question. What do you think?", dataType: UIModelData.ValueType.text.rawValue, | |
rawValue: nil, | |
label: nil, | |
valueState: nil), | |
description: UIModelDataValue(value: "A very long description which is maybe even too long but who knows :) who can really tell? I don't know. That is a real interesting question. What do you think?", dataType: UIModelData.ValueType.text.rawValue, | |
rawValue: nil, | |
label: nil, | |
valueState: nil), image: UIModelDataImage(imageUrl: "https://smaller-pictures.appspot.com/images/dreamstime_xxl_65780868_small.jpg")), | |
buttons: [ | |
UIModelDataAction("Trigger Skill", "b1", .text) | |
])).environmentObject(ThemeManager.shared) | |
} | |
static var actionButtonPreview: some View { | |
ObjectMessageView(model: UIModelDataContent(text: "text1", list: nil, form: nil, picture: nil, video: nil, | |
header: UIModelDataHeader(title: UIModelDataValue(value: "A very long title which is maybe even too long but who knows :) who can really tell? I don't know. That is a real interesting question. What do you think?", dataType: UIModelData.ValueType.text.rawValue, rawValue: nil, | |
label: nil, | |
valueState: nil), | |
subtitle: UIModelDataValue(value: "A very long subtitle which is maybe even too long but who knows :) who can really tell? I don't know. That is a real interesting question. What do you think?", dataType: UIModelData.ValueType.text.rawValue, | |
rawValue: nil, | |
label: nil, | |
valueState: nil), | |
description: UIModelDataValue(value: "A very long description which is maybe even too long but who knows :) who can really tell? I don't know. That is a real interesting question. What do you think?", dataType: UIModelData.ValueType.text.rawValue, | |
rawValue: nil, | |
label: nil, | |
valueState: nil), | |
image: UIModelDataImage(imageUrl: "https://smaller-pictures.appspot.com/images/dreamstime_xxl_65780868_small.jpg")), | |
buttons: [ | |
UIModelDataAction("B1 Trigger Skill", "b1", .text), | |
UIModelDataAction("B2 Trigger Skill", "b2", .text) | |
])).environmentObject(ThemeManager.shared) | |
} | |
static var previews: some View { | |
Group { | |
ObjectMessageView_Previews.singleButtonPreview.previewLayout(.fixed(width: 500, height: 300)) | |
ObjectMessageView_Previews.singleButtonPreview.previewLayout(.fixed(width: 800, height: 300)) | |
ObjectMessageView_Previews.actionButtonPreview.previewLayout(.fixed(width: 800, height: 300)) | |
} | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment