-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[Mobile] Generate static data to be used to develop Modal Layout picker #24027
Conversation
…odal Layour Picker
Size Change: 0 B Total Size: 1.15 MB ℹ️ View Unchanged
|
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.
LGTM!
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.
Not sure how to test this atm so I am just focusing on code and leaving small questions.
public let slug: String | ||
public let title: String | ||
public let preview: String | ||
public let categories: [GutenbergLayoutCategory] |
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.
Not sure why this is an array 🤔 Are we aware of any use case where a layout appears under different categories?
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.
I'm not sure if we would expect multiple categories for a layout or not. My goal with the structs
GutenbergPageLayouts
, GutenbergLayout
, and GutenbergLayoutCategory
was to mirror the syntax of the response that comes from the API to make parsing those a bit easier and to prevent having one struct for the API and another for the UI.
Otherwise we'll need to search in GutenbergLayout instances to get layouts for a specific category.
To prevent having to do this I added groupedLayouts to so that we only need to organize the layouts into categories once. Since it's a small n
I figured there wouldn't be a noticeable performance hit.
Sample API Response
{
"layouts": [
{
"slug": "about-2",
"title": "About",
"content": "...",
"categories": [
{
"slug": "about",
"title": "About",
"description": "About pages",
"emoji": "👋"
}
],
"preview": "https://headstartdata.files.wordpress.com/2020/01/about-2.png?w=200&zoom=1"
},
...
],
"categories": [
{
"slug": "about",
"title": "About",
"description": "About pages",
"emoji": "👋"
}
...
]
}
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.
mirror the syntax of the response that comes from the API
OK thanks, LGTM then!
public let slug: String | ||
public let title: String | ||
public let description: String | ||
public let emoji: String |
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.
Just thinking out loud, would it not be simpler if we had array of GutenbergLayout here instead? Otherwise we'll need to search in GutenbergLayout instances to get layouts for a specific category.
Partially Fixes: wordpress-mobile/gutenberg-mobile#2455
Description
Exposes static data for creating the modal layout picker for Gutenberg Mobile. The goal of placing it in the Gutenberg library was in hopes of creating a mechanism down the road where the layout can be defined once and then used to generate a file for iOS and Android.
The Preview images used below were picked to align with what would be returned by sites that use WPCOM endpoints.
How has this been tested?
This is not independently testable at this point but will be testable in WPiOS as the layout picker is developed.
Screenshots
Types of changes
New feature
Checklist: