Skip to content

Commit

Permalink
Merge pull request #6302 from gucal/master
Browse files Browse the repository at this point in the history
Match Demos
  • Loading branch information
gucal authored Apr 4, 2024
2 parents 6170fdf + f515af1 commit 941d22a
Show file tree
Hide file tree
Showing 357 changed files with 4,101 additions and 27,075 deletions.
144 changes: 0 additions & 144 deletions components/doc/accordion/pt/ptdoc.js

This file was deleted.

71 changes: 71 additions & 0 deletions components/doc/autocomplete/filleddoc.js
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} />
</>
);
}
Loading

0 comments on commit 941d22a

Please sign in to comment.