@@ -2,7 +2,8 @@ import React, { useState } from "react";
22import { SearchBar } from "../dist/SearchBar" ;
33import { sectionName } from "./sectionName" ;
44import { getStoryFactory } from "./getStory" ;
5- import { MuiSearchInput } from "./MuiSearchInput" ;
5+ import Autocomplete from "@mui/material/Autocomplete" ;
6+ import { cx } from "../dist/tools/cx" ;
67
78const { meta, getStory } = getStoryFactory ( {
89 sectionName,
@@ -143,17 +144,7 @@ function Root(){
143144export const WithMuiAutocomplete = getStory (
144145 {
145146 "renderInput" : ( { className, id, placeholder, type } ) => (
146- < MuiSearchInput
147- className = { className }
148- id = { id }
149- placeholder = { placeholder }
150- type = { type }
151- value = ""
152- onChange = { ( ) => {
153- /**/
154- } }
155- results = { [ ] }
156- />
147+ < MuiSearchInput className = { className } id = { id } placeholder = { placeholder } type = { type } />
157148 )
158149 } ,
159150 {
@@ -214,8 +205,37 @@ function MySearchInput(props: MySearchInputProps) {
214205 )}
215206/>
216207\`\`\`
217-
218-
219208`
220209 }
221210) ;
211+
212+ export type MuiSearchInputProps = {
213+ className : string ;
214+ id : string ;
215+ placeholder : string ;
216+ type : "search" ;
217+ } ;
218+
219+ const options = [ "Option 1" , "Option 2" ] ;
220+
221+ export function MuiSearchInput ( props : MuiSearchInputProps ) {
222+ const { className, id, placeholder, type } = props ;
223+
224+ return (
225+ < Autocomplete
226+ style = { { "width" : "100%" } }
227+ id = { id }
228+ options = { options }
229+ renderInput = { params => (
230+ < div ref = { params . InputProps . ref } >
231+ < input
232+ { ...params . inputProps }
233+ className = { cx ( params . inputProps . className , className ) }
234+ placeholder = { placeholder }
235+ type = { type }
236+ />
237+ </ div >
238+ ) }
239+ />
240+ ) ;
241+ }
0 commit comments