-
Notifications
You must be signed in to change notification settings - Fork 39
docs: migrating facet manager documentation #6564
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR migrates the documentation for atomic-facet-manager from handwritten documentation to Storybook's MDX format, aligning it with the documentation pattern used across other Atomic components.
Key Changes
- Created new
atomic-facet-manager.mdxfile following theAtomicDocTemplatepattern - Documented the component's role in handling facet DOM manipulation and lifecycle
- Included references to Stencil lifecycle documentation and custom component creation guidance
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/atomic/src/components/search/atomic-facet-manager/atomic-facet-manager.mdx
Outdated
Show resolved
Hide resolved
packages/atomic/src/components/search/atomic-facet-manager/atomic-facet-manager.mdx
Outdated
Show resolved
Hide resolved
bdf83f5 to
f875337
Compare
| The `atomic-facet-manager` is designed to handle the removal and re-attachment of <a href="?path=/story/atomic-facet--default">facet</a> components | ||
| to the DOM. | ||
| This means that the [Stencil lifecycle](https://stenciljs.com/docs/component-lifecycle#component-lifecycle-methods) applies to the slotted facets. | ||
|
|
||
| If you <a href="https://docs.coveo.com/en/atomic/latest/usage/custom-web-components#custom-component-example">create your own custom facet component</a> and slot it inside of the `atomic-facet-manager`, it will have to be able to handle the Stencil reattachment lifecycle. | ||
| Alternately, you can place your custom component outside of the `atomic-facet-manager`, in which case the Stencil lifecycle won’t apply. |
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.
This documentation is actually outdated because we dont use stencil anymore. This is a doc that I made using copilot and I think it is more accurate and helpful. What do you think ?
The `atomic-facet-manager` is a component that manages facets by performing three key functions:
1. **Sorting facets** - Reorders facets based on the search response to show the most relevant facets first
2. **Managing visibility** - Controls which facets should be visible or hidden based on available values and dependencies
3. **Managing collapse state** - Automatically expands or collapses facets based on the `collapse-facets-after` property
## Usage
Place facets inside the `atomic-facet-manager` component within the "facets" section of your layout:
```html
<atomic-search-interface>
...
<atomic-search-layout>
<atomic-layout-section section="facets">
<atomic-facet-manager collapse-facets-after="4">
<atomic-facet field="author" label="Authors"></atomic-facet>
<atomic-facet field="source" label="Source"></atomic-facet>
<atomic-category-facet field="geographicalhierarchy" label="Geography"></atomic-category-facet>
<atomic-numeric-facet field="ytviewcount" label="Views"></atomic-numeric-facet>
<atomic-automatic-facet-generator desired-count="3"></atomic-automatic-facet-generator>
</atomic-facet-manager>
</atomic-layout-section>
</atomic-search-layout>
</atomic-search-interface>
Collapse Behavior
The collapse-facets-after property controls how many facets remain expanded:
- Default (4): First 4 facets are expanded, remaining facets are collapsed
- 0: All facets are collapsed
- -1: All facets remain expanded (useful when you want to control collapse state individually on each facet)
Dynamic Navigation Experience (DNE)
When using the facet manager, facets will automatically reorder based on their relevance to the current search query, providing an optimal filtering experience for users.
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.
Most of this does look like an improvement without a doubt, but I'm wary about the Collapse Behaviour section as that is directly duplicating information in the Attributes section of the component. We should be training users to reference that section for the props of the components.
I'm also going to massage the text for DNE and provide pertinent links to the docs site
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 agree with the Collapse part 👍 . Good point
f875337 to
855981c
Compare
Updated documentation for the atomic-facet-manager component.
| - `@coveo/atomic/lang`: exports the localization files used by Coveo Atomic. | ||
|
|
||
| ## Getting Started | ||
|
|
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.
@louis-bompart Just tagging you to review the updates to the README here.
| ```sh | ||
| # ❌ Deprecated method | ||
| cd package/atomic | ||
| pnpm run dev | ||
| ``` |
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.
You can remove this as this just won't work
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.
This 100% does work. Its how I've been running the storybook site until I was corrected (which is why i specifically included this)
[tbaxter:~/Documents/code/ui-kit/packages/atomic]$ pnpm run dev
> @coveo/atomic@3.39.1 dev /Users/tbaxter/Documents/code/ui-kit/packages/atomic
> node ./scripts/dev.mjs
🚀 Starting development servers...
⌛ Waiting for Storybook (4400) and Vite (3333)...
✅ Servers started! Watching for changes...
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.
oh right my bad !
This migrates the handwritten documentation for
atomic-facet-managerover to storybook documentation