-
Notifications
You must be signed in to change notification settings - Fork 145
feat(Compass): add handbook doc page #4877
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
Open
kmcfaul
wants to merge
2
commits into
patternfly:main
Choose a base branch
from
kmcfaul:compass-handbook
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 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
158 changes: 158 additions & 0 deletions
158
packages/documentation-site/patternfly-docs/content/AI/Compass/CompassHandbook.md
This file contains hidden or 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,158 @@ | ||||||||
| --- | ||||||||
| id: Compass | ||||||||
| section: AI | ||||||||
| source: guide | ||||||||
| subsection: Generative UIs | ||||||||
| --- | ||||||||
|
|
||||||||
|
Collaborator
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.
Suggested change
|
||||||||
| When building a layout for generative UIs using the Compass components, there are several common patterns that may be implemented using Patternfly components and component variants. | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| ### Compass structure | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| #### Containers & glass theme | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| The glass look and feel is an opt-in global styling applied when `pf-v6-theme-glass` is present on the `html` element class list, similar to dark theme. For compass layouts, content that has the glass background and rounded borders should be wrapped in a `CompassPanel` (and some compass components will do this automatically). This component has various options to customize its own padding and behavior to fit the context of its usage, and so is present in nearly every area of a compass page. `CompassPanels` should not be directly nested if the glass theme is applied to prevent styling issues. | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| #### Header | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| A compass layout header will typically be constructed using a `CompassHeader` component, which constructs three sections: logo, nav, and profile. These sections may be passed any content, but here are some recommendations when building a compass layout: | ||||||||
| - The logo should contain a `Brand` or other logo image or svg. | ||||||||
| - The profile should contain a `Dropdown` with a user `Avatar` within the `MenuToggle`. | ||||||||
| - The nav should contain a `CompassNavContent` component, which usually contains `CompassNavHome`, `CompassNavMain`, and `CompassNavSearch` components as shown below in a snippet. `CompassNavHome` and `CompassNavSearch` are opinionated components that will automatically provide a home and search button, and are optional. `CompassNavMain` will usually contain a `Tabs` component with the `isNav` flag to enable a top-level navigation type of styling. | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
kmcfaul marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| ``` | ||||||||
| <CompassNavContent> | ||||||||
| <CompassNavHome onClick={() => console.log('Home')} /> | ||||||||
| <CompassNavMain> | ||||||||
| <Tabs isNav /> | ||||||||
| </CompassNavMain> | ||||||||
| <CompassNavSearch onClick={() => console.log('Search')} /> | ||||||||
| </CompassNavContent> | ||||||||
| ``` | ||||||||
|
|
||||||||
| #### Sidebars | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| There are two sidebars in a compass layout at the start and end of the page. There is no specific `Compass` helper component for these sections, and so usually a `CompassPanel` containing an `ActionList` with the `isVertical` flag will be passed to represent the side navigations. | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| #### Footer | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| There are two methods of adding a footer to a compass layout. In either case, a footer's content will remain the same and will usually consist of a `@patternfly/chatbot` `MessageBar`, wrapped by a `CompassPanel` and `CompassMessageBar` component, as shown below: | ||||||||
|
|
||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| ``` | ||||||||
| <CompassMessageBar> | ||||||||
| <CompassPanel isPill hasNoPadding hasNoBorder> | ||||||||
| <MessageBar /> | ||||||||
| <div aria-live="polite" className="pf-v6-screen-reader"> | ||||||||
| // aria anouncments for message bar's state updates | ||||||||
| </div> | ||||||||
| </CompassPanel> | ||||||||
| </CompassMessageBar> | ||||||||
| ``` | ||||||||
|
|
||||||||
| In the first method of adding a footer, pass this content to the `footer` prop of the `Compass` component. This type of footer will extend the entire width of the viewport. However, if the footer content is expected to change in height (such as when MessageBar content expands), the sidebars will adjust their positioning. If this behavior is not desired, please use the second method and forego passing the `footer` prop. | ||||||||
|
|
||||||||
| For the second method of adding a footer, wrap the content in `CompassMainFooter` and pass it as part of the `main` content of the `Compass`. This will allow the sidebars to extend through to the bottom of the viewport and prevents them from resizing based on changing footer content height. | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| #### Main content | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| The main content, taking up the center of viewport, will typically consist of a `Hero` or `CompassMainHeader`, a `CompassContent`, and an optional `CompassMainFooter`. | ||||||||
|
|
||||||||
| A typical compass page will consist of a `CompassMainHeader` and `CompassContent` with a `CompassPanel` child, and content of the page should go inside of this `CompassPanel`. | ||||||||
|
|
||||||||
| When making a dashboard view, use a `Hero` instead of a `CompassMainHeader`. And instead of having a single `CompassPanel` within a `CompassContent`, each individual dashbaord item should be wrapped in a `CompassPanel`. For example, in a dashboard that has many content cards, each `Card` (with `isPlain` flag) is wrapped by a `CompassPanel` inside of a `Grid`. | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| ### CSS | ||||||||
|
|
||||||||
| PatternFly's token system allows additional customization of the look and feel of a compass layout. | ||||||||
| For example, the following css mixin utilizes several global token overrides to better match the Red Hat Design System look and feel. | ||||||||
kmcfaul marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| ``` | ||||||||
| @mixin pf-v6-tokens { | ||||||||
| // brand tokens | ||||||||
| --pf-t--global--color--brand--100: var(--pf-t--color--red--40); | ||||||||
| --pf-t--global--color--brand--200: var(--pf-t--color--red--50); | ||||||||
| --pf-t--global--color--brand--300: var(--pf-t--color--red--60); | ||||||||
| --pf-t--global--color--brand--400: var(--pf-t--color--red--70); | ||||||||
| --pf-t--global--color--brand--500: var(--pf-t--color--red--80); | ||||||||
|
|
||||||||
| // dark brand tokens | ||||||||
| --pf-t--global--dark--color--brand--100: var(--pf-t--color--red--30); | ||||||||
| --pf-t--global--dark--color--brand--200: var(--pf-t--color--red--20); | ||||||||
| --pf-t--global--dark--color--brand--300: var(--pf-t--color--red--10); | ||||||||
|
|
||||||||
| // font size | ||||||||
| --pf-t--global--font--size--900: 2.5rem; | ||||||||
| --pf-t--global--font--size--1000: 3rem; | ||||||||
|
|
||||||||
| // bumped by one | ||||||||
| --pf-t--global--font--size--2xl: var(--pf-t--global--font--size--700); | ||||||||
| --pf-t--global--font--size--3xl: var(--pf-t--global--font--size--800); | ||||||||
| --pf-t--global--font--size--4xl: var(--pf-t--global--font--size--900); | ||||||||
| --pf-t--global--font--size--lg: var(--pf-t--global--font--size--500); | ||||||||
| --pf-t--global--font--size--md: var(--pf-t--global--font--size--400); | ||||||||
| --pf-t--global--font--size--sm: var(--pf-t--global--font--size--300); | ||||||||
| --pf-t--global--font--size--xl: var(--pf-t--global--font--size--600); | ||||||||
| --pf-t--global--font--size--xs: var(--pf-t--global--font--size--200); | ||||||||
|
|
||||||||
| // icon sizes | ||||||||
| --pf-t--global--icon--size--100: 1rem; | ||||||||
| --pf-t--global--icon--size--200: 1.5rem; | ||||||||
| --pf-t--global--icon--size--250: 2rem; | ||||||||
| --pf-t--global--icon--size--300: 2.5rem; | ||||||||
| --pf-t--global--icon--size--400: 6rem; | ||||||||
| --pf-t--global--icon--size--500: 8rem; | ||||||||
|
|
||||||||
| // spacing | ||||||||
| --pf-t--global--spacer--action--horizontal--compact: var(--pf-t--global--spacer--lg); | ||||||||
| --pf-t--global--spacer--action--horizontal--default: var(--pf-t--global--spacer--xl); | ||||||||
| --pf-t--global--spacer--action--horizontal--plain--compact: var(--pf-t--global--spacer--sm); | ||||||||
| --pf-t--global--spacer--action--horizontal--plain--default: var(--pf-t--global--spacer--md); | ||||||||
| --pf-t--global--spacer--action--horizontal--spacious: var(--pf-t--global--spacer--2xl); | ||||||||
| --pf-t--global--spacer--control--horizontal--compact: var(--pf-t--global--spacer--md); | ||||||||
| --pf-t--global--spacer--control--horizontal--default: var(--pf-t--global--spacer--xl); | ||||||||
| --pf-t--global--spacer--control--horizontal--plain: var(--pf-t--global--spacer--md); | ||||||||
| --pf-t--global--spacer--control--horizontal--spacious: var(--pf-t--global--spacer--xl); | ||||||||
| --pf-t--global--spacer--control--vertical--compact: var(--pf-t--global--spacer--sm); | ||||||||
| --pf-t--global--spacer--control--vertical--default: var(--pf-t--global--spacer--md); | ||||||||
| --pf-t--global--spacer--control--vertical--plain: var(--pf-t--global--spacer--md); | ||||||||
| --pf-t--global--spacer--control--vertical--spacious: var(--pf-t--global--spacer--lg); | ||||||||
| --pf-t--global--spacer--gap--action-to-action--default: var(--pf-t--global--spacer--lg); | ||||||||
| --pf-t--global--spacer--gap--action-to-action--plain: var(--pf-t--global--spacer--sm); | ||||||||
| --pf-t--global--spacer--gap--control-to-control--default: var(--pf-t--global--spacer--sm); | ||||||||
| --pf-t--global--spacer--gap--group--horizontal: var(--pf-t--global--spacer--lg); | ||||||||
| --pf-t--global--spacer--gap--group--vertical: var(--pf-t--global--spacer--md); | ||||||||
| --pf-t--global--spacer--gap--group-to-group--horizontal--compact: var(--pf-t--global--spacer--md); | ||||||||
| --pf-t--global--spacer--gap--group-to-group--horizontal--default: var(--pf-t--global--spacer--3xl); | ||||||||
| --pf-t--global--spacer--gap--group-to-group--vertical--compact: var(--pf-t--global--spacer--lg); | ||||||||
| --pf-t--global--spacer--gap--group-to-group--vertical--default: var(--pf-t--global--spacer--xl); | ||||||||
| --pf-t--global--spacer--gap--text-to-element--compact: var(--pf-t--global--spacer--sm); | ||||||||
| --pf-t--global--spacer--gap--text-to-element--default: var(--pf-t--global--spacer--md); | ||||||||
| --pf-t--global--spacer--gutter--default: var(--pf-t--global--spacer--lg); | ||||||||
| --pf-t--global--spacer--inset--page-chrome: var(--pf-t--global--spacer--xl); | ||||||||
|
|
||||||||
| // Glass theme tokens | ||||||||
| --pf-t--global--light--glass--background--color--glass--color: var(--pf-t--global--color--brand--500); | ||||||||
| --pf-t--global--light--glass--background--color--glass--filter: blur(12.5px); | ||||||||
| --pf-t--global--light--glass--background--color--glass--opacity: 10%; | ||||||||
| --pf-t--global--light--glass--background--color--glass--default: color-mix(in srgb, var(--pf-t--global--light--glass--background--color--glass--color) var(--pf-t--global--light--glass--background--color--glass--opacity), transparent ); | ||||||||
| --pf-t--global--dark--glass--background--color--glass--color: var(--pf-t--global--color--brand--500); | ||||||||
| --pf-t--global--dark--glass--background--color--glass--filter: blur(12.5px); | ||||||||
| --pf-t--global--dark--glass--background--color--glass--opacity: 65%; | ||||||||
| --pf-t--global--dark--glass--background--color--glass--default: color-mix(in srgb, var(--pf-t--global--dark--glass--background--color--glass--color) var(--pf-t--global--dark--glass--background--color--glass--opacity), transparent ); | ||||||||
|
|
||||||||
| // Message bar tokens | ||||||||
| --pf-v6-c-compass__message-bar--Width: 600px; | ||||||||
| --pf-v6-c-compass__message-bar--MinWidth: 450px; | ||||||||
| --pf-v6-c-compass__message-bar--MaxWidth: 900px; | ||||||||
|
|
||||||||
| // Thinking tokens | ||||||||
| --pf-v6-global--thinking--BoxShadow--Spread: 5px; | ||||||||
| --pf-v6-global--thinking--BoxShadow--Color--Start-Start: var(--pf-t--global--color--brand--100); | ||||||||
| --pf-v6-global--thinking--BoxShadow--Color--Start-End: var(--pf-t--color--white); | ||||||||
| --pf-v6-global--thinking--BoxShadow--Color--End-Start: var(--pf-t--global--color--brand--500); | ||||||||
| --pf-v6-global--thinking--BoxShadow--Color--End-End: var(--pf-t--global--color--brand--300); | ||||||||
| --pf-v6-global--thinking-active--BoxShadow--Spread: 10px; | ||||||||
|
|
||||||||
| .pf-v6-m-ai-indicator { | ||||||||
| &::before { | ||||||||
| background: linear-gradient(to right, #f56e6e 0%, var(--pf-t--global--color--brand--300) 65%, var(--pf-t--global--color--brand--500) 100%) | ||||||||
| border-box; | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
| ``` | ||||||||
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.
Uh oh!
There was an error while loading. Please reload this page.