Skip to content

Commit 0df917b

Browse files
Copiloty-lakhdar
andcommitted
Step 7: Add comprehensive MDX documentation
Co-authored-by: y-lakhdar <12199712+y-lakhdar@users.noreply.github.com>
1 parent 146bdbc commit 0df917b

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
import { Meta } from '@storybook/addon-docs/blocks';
2+
import * as AtomicRatingFacetStories from './atomic-rating-facet.new.stories';
3+
import { AtomicDocTemplate } from '../../../../../storybook-utils/documentation/atomic-doc-template';
4+
5+
<Meta of={AtomicRatingFacetStories} />
6+
7+
<AtomicDocTemplate
8+
stories={AtomicRatingFacetStories}
9+
githubPath="search/facets/atomic-rating-facet/atomic-rating-facet.ts"
10+
tagName="atomic-rating-facet"
11+
className="AtomicRatingFacet"
12+
>
13+
14+
The `atomic-rating-facet` component displays facet values as star ratings, making it ideal for rating fields in your search results. It supports numeric fields and displays values as configurable star ratings.
15+
16+
This component is typically placed within the "facets" section of the search interface layout.
17+
18+
You can also place rating facets inside an `atomic-facet-manager` component to ensure the effective functioning of DNE (Dynamic Navigation Experience).
19+
More info here: [atomic-facet-manager](https://docs.coveo.com/en/2918).
20+
21+
## Key Features
22+
23+
- **Star Rating Display**: Visualizes numeric values as star ratings
24+
- **Flexible Display Modes**: Support for checkbox (multi-select) or link (single-select) modes
25+
- **Customizable Icons**: Use custom SVG icons for rating display
26+
- **Configurable Intervals**: Set the number of rating intervals and their range
27+
- **Tab Integration**: Support for included/excluded tabs
28+
- **Facet Dependencies**: Can depend on other facet selections
29+
30+
## Basic Usage
31+
32+
```html
33+
<atomic-search-interface>
34+
...
35+
<atomic-search-layout>
36+
...
37+
<atomic-layout-section section="facets">
38+
...
39+
<atomic-rating-facet field="snrating" label="Rating"></atomic-rating-facet>
40+
41+
</atomic-layout-section>
42+
</atomic-search-layout>
43+
</atomic-search-interface>
44+
```
45+
46+
## Display Modes
47+
48+
### Checkbox Mode (Default)
49+
Allows multiple rating selections:
50+
51+
```html
52+
<atomic-rating-facet
53+
field="rating"
54+
label="Customer Rating"
55+
display-values-as="checkbox">
56+
</atomic-rating-facet>
57+
```
58+
59+
### Link Mode
60+
Allows single rating selection:
61+
62+
```html
63+
<atomic-rating-facet
64+
field="rating"
65+
label="Customer Rating"
66+
display-values-as="link">
67+
</atomic-rating-facet>
68+
```
69+
70+
## Custom Rating Intervals
71+
72+
Configure the number of stars and value ranges:
73+
74+
```html
75+
<atomic-rating-facet
76+
field="rating"
77+
label="Rating"
78+
number-of-intervals="10"
79+
max-value-in-index="10"
80+
min-value-in-index="1">
81+
</atomic-rating-facet>
82+
```
83+
84+
## Custom Icon
85+
86+
Use a custom SVG icon for the rating display:
87+
88+
```html
89+
<atomic-rating-facet
90+
field="rating"
91+
label="Rating"
92+
icon="<svg>...</svg>">
93+
</atomic-rating-facet>
94+
```
95+
96+
The custom icon should include `fill="currentColor"` to properly support active/inactive color states.
97+
98+
## Related Components
99+
100+
- **[atomic-facet](/?path=/docs/search-facet--docs)** - Standard text facet
101+
- **[atomic-numeric-facet](/?path=/docs/search-numericfacet--docs)** - Numeric range facet
102+
- **[atomic-facet-manager](https://docs.coveo.com/en/2918)** - Dynamic facet management
103+
104+
</AtomicDocTemplate>

0 commit comments

Comments
 (0)