Skip to content

Commit 81d38a4

Browse files
authored
fix(search-results): add search-results templating story (#3416)
1 parent f185d90 commit 81d38a4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* -------------------------------------------------------------------------------------------
3+
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
4+
* See License in the project root for license information.
5+
* -------------------------------------------------------------------------------------------
6+
*/
7+
8+
import { html } from 'lit';
9+
import { withCodeEditor } from '../../../.storybook/addons/codeEditorAddon/codeAddon';
10+
11+
export default {
12+
title: 'Components / mgt-search-results / Templating',
13+
component: 'search-results',
14+
decorators: [withCodeEditor]
15+
};
16+
17+
export const DefaultTemplates = () => html`
18+
<mgt-search-results query-string="contoso" entity-types="site">
19+
<template data-type="default">
20+
<div data-for="result in value[0].hitsContainers[0].hits">
21+
<div class="displayName">{{result.resource.displayName}}</div>
22+
</div>
23+
</template>
24+
<template data-type="loading">
25+
Loading
26+
</template>
27+
</mgt-search-results>
28+
`;
29+
30+
export const noDataTemplate = () => html`
31+
<div>
32+
<div>No data template</div>
33+
<mgt-search-results query-string="xyxy" entity-types="driveItem">
34+
<template data-type="no-data">
35+
<div>No results found</div>
36+
</template>
37+
</mgt-search-results>
38+
</div>
39+
`;

0 commit comments

Comments
 (0)