-
Notifications
You must be signed in to change notification settings - Fork 1
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
Write ADR for Page Layouts #544
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
status: Approved | ||
date: 2023-08-17 | ||
deciders: stephenjwatkins, OskiTheCoder, ldewald | ||
--- | ||
|
||
# Incorporate page layouts in Easy UI | ||
|
||
## Context and Problem Statement | ||
|
||
Easy UI is evaluating the inclusion of site-specific page layouts in its component library. While shared, specialized components are commonly part of libraries, broader page layout components are often left to the app. This decision record will assess the situation and attempt to align with the organization's needs. | ||
|
||
## Decision Drivers | ||
|
||
- Compatibility with frameworks and site architectures | ||
- Support for site-specific business logic and extensibility | ||
- Adherence to quality standards | ||
- Scalability with evolving design, Easy UI, and consuming sites | ||
- Minimal disruption for site developers | ||
|
||
## Options Considered | ||
|
||
- Include page layout components in Easy UI | ||
- Develop a "Patterns" guide for Easy UI-based page layout creation | ||
- Opt-out of page layouts, deferring responsibility to sites | ||
|
||
## Decision Outcome | ||
|
||
Easy UI will incorporate page layouts into its component library as "PageShell" components, focusing solely on presentation while delegating business logic to consumers. | ||
|
||
## Analysis | ||
|
||
Various component libraries adopt different strategies for managing page layouts, each with its own set of advantages and limitations. These strategies include: | ||
|
||
**Opting Out**: Many component libraries choose not to include predefined page layouts. This approach allows the library to focus on specific, shared functionalities. While it reduces responsibilities for platform teams, it places greater onus on feature teams. As a consequence, without the support of component library tools, feature teams may need to implement elements of their own, potentially leading to inconsistent and suboptimal user experiences (UX). | ||
|
||
**Using Documented "Patterns"**: Some component libraries provide users with documented "Patterns" to guide them in creating layouts using the library's components. This approach simplifies implementation compared to starting from scratch and permits customization at the site level. However, it can still result in disparities and duplicated efforts over time. For this method to be successful, Easy UI must build and document all essential components necessary for building page layouts. | ||
|
||
**Including Page Layouts**: Another approach involves supplying dedicated page layout components with predefined slots for content placement. This shifts the responsibility onto the component library and platform team, reducing the implementation burden on feature teams. This approach limits flexibility outside the library and mandates updates to adhere to the component library's processes. Nonetheless, this facilitates the use of component library tooling and processes, enhancing consistency and UX. | ||
|
||
It's important to emphasize that, regardless of the approach chosen, the handling of business logic remains the responsibility of the consumer. Components should exclusively address presentation-related matters. | ||
|
||
**We opt to develop and maintain page layout components within Easy UI.** Considering EasyPost's organizational structure, which consists of distinct feature teams, and acknowledging the limited quality of UX tooling outside the component library, Easy UI emerges as the best choice for success with page layout components. | ||
|
||
These components will include essential properties and hooks, enabling consuming sites to meet their individual design and feature requisites. This decision benefits our entire platform by promoting uniformity and upholding higher quality standards, particularly for page layouts being some of the more UI-challenging aspects of our sites. | ||
|
||
**Regarding Terminology:** Although we will incorporate these components into Easy UI, we intend to preserve the distinct meanings of "page" and "layout" found in web frameworks. "Pages" often represent terminal nodes in routing structures, whereas "layouts" signify branches. Both pages and layouts commonly involve specific business logic pertaining to their respective parts of the routing tree. Since Easy UI exclusively deals with presentation-related concerns, we will avoid naming components in a way that might confuse or overlap with these established semantics. Instead, we will adopt the term "Shell" (i.e. `ProductShell`), to explicitly indicate that it encompasses the outer presentation container of the corresponding layout. | ||
|
||
## Example | ||
|
||
_app/layouts/DashboardLayout:_ | ||
|
||
```tsx | ||
import { ProductShell } from "@easypost/easy-ui/FocusedProductLayout"; | ||
|
||
// DashboardLayout component handles site-specific business logic (e.g. | ||
// determining logged in user, redirects, etc) | ||
function DashboardLayout() { | ||
return ( | ||
<ProductShell> | ||
<ProductShell.Sidebar {/* props and hooks for customization */} /> | ||
<ProductShell.Body {/* props and hooks for customization */} /> | ||
<ProductShell> | ||
); | ||
} | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
per usual, while i tend to believe in this sentiment, i'm not married to the term
Shell
, and am open to suggestions. from what i've seen of component libraries, they often use the suffixLayout
, but from experience in our own codebase, that term easily becomes conflated and confusing, but happy to use it if it simply makes the most senseThere 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.
Template
is another one to throw in the "what does this actually mean" ring. Shell makes sense to me and we can always change it later if folks find it confusing.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.
sounds good. agree that
Template
is another one to throw into the ring