Skip to content

Commit 6666e0a

Browse files
update examples
1 parent 768e733 commit 6666e0a

File tree

4 files changed

+27
-49
lines changed

4 files changed

+27
-49
lines changed

example/stories/constant-suggestions-list/README.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

example/stories/dynamic-suggestions-list/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#### `outline` theme + Dynamic suggestion list
2+
3+
##### Type A|B|C|D|Item to see the suggestion list
4+
15
```jsx
26
import React, {useState} from 'react';
37
import ReactCustomSearchList from 'react-custom-search-list';
@@ -13,6 +17,7 @@ function App() {
1317
onChange={(e) => setValue(e.target.value)}
1418
onClear={() => setValue('')}
1519
fullWidth
20+
theme="outline"
1621
corner>
1722
{/**Render your suggestions list here*/}
1823
{value

example/stories/panel-theme/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#### `panel` theme + Constant suggestion list
2+
13
```jsx
24
import React, {useState} from 'react';
35
import ReactCustomSearchList from 'react-custom-search-list';

example/stories/underline-theme/README.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
#### `underline` theme + Constant suggestion list
2+
13
```jsx
24
import React, {useState} from 'react';
35
import ReactCustomSearchList from 'react-custom-search-list';
46
import 'react-custom-search-list/style/react-custom-search-list.css';
5-
6-
const items = ['Item A', 'Item B', 'Item C', 'Item D'];
7-
87
function App() {
98
const [value, setValue] = useState('');
109
return (
@@ -16,15 +15,24 @@ function App() {
1615
fullWidth
1716
corner>
1817
{/**Render your suggestions list here*/}
19-
{value
20-
? items
21-
.filter((item) => item.toLowerCase().includes(value.toLowerCase()))
22-
.map((item) => (
23-
<div key={item} style={{margin: '5px'}}>
24-
<p onClick={() => setValue(item)}>{item}</p>
25-
</div>
26-
))
27-
: null}
18+
<ul>
19+
<li>
20+
<button onClick={() => setValue('Option A')}>Option A</button>
21+
</li>
22+
<li>
23+
<button onClick={() => setValue('Option B')}>Option B</button>
24+
</li>
25+
<li>
26+
<a href="https://github.com/dev-javascript/react-custom-search-list" target="_blank">
27+
Github Link
28+
</a>
29+
</li>
30+
<li>
31+
<a href="https://www.npmjs.com/package/react-custom-search-list" target="_blank">
32+
NPM Link
33+
</a>
34+
</li>
35+
</ul>
2836
</ReactCustomSearchList>
2937
);
3038
}

0 commit comments

Comments
 (0)