-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6302 from gucal/master
Match Demos
- Loading branch information
Showing
357 changed files
with
4,101 additions
and
27,075 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { DocSectionCode } from '@/components/doc/common/docsectioncode'; | ||
import { DocSectionText } from '@/components/doc/common/docsectiontext'; | ||
import { AutoComplete } from '@/components/lib/autocomplete/AutoComplete'; | ||
import { useState } from 'react'; | ||
|
||
export function FilledDoc(props) { | ||
const [value, setValue] = useState(''); | ||
const [items, setItems] = useState([]); | ||
|
||
const search = (event) => { | ||
setItems([...Array(10).keys()].map((item) => event.query + '-' + item)); | ||
}; | ||
|
||
const code = { | ||
basic: ` | ||
<AutoComplete value={value} suggestions={items} completeMethod={search} onChange={(e) => setValue(e.value)} variant="filled" /> | ||
`, | ||
javascript: ` | ||
import React, { useState } from "react"; | ||
import { AutoComplete } from "primereact/autocomplete"; | ||
export default function FilledDemo() { | ||
const [value, setValue] = useState(''); | ||
const [items, setItems] = useState([]); | ||
const search = (event) => { | ||
setItems([...Array(10).keys()].map(item => event.query + '-' + item)); | ||
} | ||
return ( | ||
<div className="card flex justify-content-center"> | ||
<AutoComplete value={value} suggestions={items} completeMethod={search} onChange={(e) => setValue(e.value)} variant="filled" /> | ||
</div> | ||
) | ||
} | ||
`, | ||
typescript: ` | ||
import React, { useState } from "react"; | ||
import { AutoComplete, AutoCompleteCompleteEvent } from "primereact/autocomplete"; | ||
export default function FilledDemo() { | ||
const [value, setValue] = useState<string>(''); | ||
const [items, setItems] = useState<string[]>([]); | ||
const search = (event: AutoCompleteCompleteEvent) => { | ||
setItems([...Array(10).keys()].map(item => event.query + '-' + item)); | ||
} | ||
return ( | ||
<div className="card flex justify-content-center"> | ||
<AutoComplete value={value} suggestions={items} completeMethod={search} onChange={(e) => setValue(e.value)} variant="filled" /> | ||
</div> | ||
) | ||
} | ||
` | ||
}; | ||
|
||
return ( | ||
<> | ||
<DocSectionText {...props}> | ||
<p> | ||
Specify the <i>variant</i> property as <i>filled</i> to display the component with a higher visual emphasis than the default <i>outlined</i> style. | ||
</p> | ||
</DocSectionText> | ||
<div className="card flex justify-content-center"> | ||
<AutoComplete value={value} suggestions={items} completeMethod={search} onChange={(e) => setValue(e.value)} variant="filled" /> | ||
</div> | ||
<DocSectionCode code={code} /> | ||
</> | ||
); | ||
} |
Oops, something went wrong.