Skip to content

Commit

Permalink
vidange input après ssoumission
Browse files Browse the repository at this point in the history
  • Loading branch information
sadjoaldi committed Feb 26, 2025
1 parent c338dfd commit c7db44e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/components/comics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default function Comics({ data, onClick }) {
</button>
<div className='comics'>
{data.map((dataItem) => {
const detailsUrl = dataItem.urls.find((element) => element['type'] === 'detail').url;
return (
<Link
to={`/comics/${dataItem.id}`}
key={dataItem.id}
className='comic-card'
style={{
Expand All @@ -44,9 +44,6 @@ export default function Comics({ data, onClick }) {
e.stopPropagation();
onClick(dataItem.id);
}}
href={detailsUrl}
target='_blank'
rel='noreferrer'
>
<div className='comics-title'>
<h3>{dataItem.title}</h3>
Expand Down
3 changes: 2 additions & 1 deletion src/components/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function Search() {
const handleSubmit = (event) => {
event.preventDefault();
getCharacterData();
setCharacterName('');
};

const getCharacterData = () => {
Expand Down Expand Up @@ -58,7 +59,7 @@ export default function Search() {
return (
<>
<form className='' onSubmit={handleSubmit}>
<input type='text' placeholder='Search' onChange={handleChange} />
<input type='text' placeholder='Search' value={characterName} onChange={handleChange} />
</form>

{!comicData && characterData && characterData.results[0] && (
Expand Down

0 comments on commit c7db44e

Please sign in to comment.