Skip to content

Commit

Permalink
[MIM-1787] Fix search in 404 page. Cant hydrate so use good ol html (#…
Browse files Browse the repository at this point in the history
…2465)

Fix search in 404 page. Cant hydrate so use good ol html
  • Loading branch information
omsaggau authored Jan 26, 2024
1 parent 7c265c7 commit 01b9a67
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"@item-enonic-types/lib-thymeleaf": "~2.1.0",
"@item-enonic-types/lib-time": "~1.0.3",
"@reduxjs/toolkit": "~1.9.7",
"@statisticsnorway/ssb-component-library": "~2.0.96",
"@statisticsnorway/ssb-component-library": "~2.0.97",
"@types/ramda": "~0.29.9",
"@types/react": "~18.2.48",
"@types/uuid": "~9.0.7",
Expand Down
13 changes: 5 additions & 8 deletions src/main/resources/react4xp/_entries/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@ import { Input } from '@statisticsnorway/ssb-component-library'
import PropTypes from 'prop-types'

const Search = (props) => {
const handleSubmit = (value) => {
window.location = `${props.searchResultPageUrl}?sok=${value}`
}

// No pageContributions in error mode, so can't hydrate React components. Thus we go for a simple form.
return (
<React.Fragment>
<form action={props.searchResultPageUrl} method='get'>
<Input
id='search_ssb'
name='sok'
ariaLabel={props.searchText}
searchField
submitCallback={handleSubmit}
placeholder={props.searchText}
ariaLabelSearchButton={props.searchText}
className={props.className}
/>
</React.Fragment>
</form>
)
}

Expand All @@ -28,4 +25,4 @@ Search.propTypes = {
searchResultPageUrl: PropTypes.string,
}

export default Search
export default (props) => <Search {...props} />

0 comments on commit 01b9a67

Please sign in to comment.