-
Notifications
You must be signed in to change notification settings - Fork 1
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 #126 from M3nin0/dev
form: update filter to use new type field
- Loading branch information
Showing
7 changed files
with
91 additions
and
4 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ jobs: | |
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
node-version: [18] | ||
|
||
steps: | ||
- name: Checkout | ||
|
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
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,68 @@ | ||
/* | ||
* This file is part of GEO-Components-React. | ||
* Copyright (C) 2022 GEO Secretariat. | ||
* | ||
* GEO-Components-React is free software; you can redistribute it and/or modify it | ||
* under the terms of the MIT License; see LICENSE file for more details. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import PropTypes from 'prop-types'; | ||
import { SelectField } from 'react-invenio-forms'; | ||
|
||
import { i18next } from '@translations/i18next'; | ||
import { Icon } from 'semantic-ui-react'; | ||
|
||
/** | ||
* Record Type field for the GEO Knowledge Hub. | ||
* @constructor | ||
* | ||
* @param {String} fieldPath Path where the field data will be stored in the | ||
* Formik context. | ||
* @param {Object} fieldProps (Spread) Extra parameters for the `SelectField`. | ||
*/ | ||
export const RecordTypeField = ({ fieldPath, ...fieldProps }) => { | ||
return ( | ||
<SelectField | ||
fieldPath={fieldPath} | ||
options={[ | ||
{ | ||
id: 'package', | ||
key: 'package', | ||
text: 'Knowledge Package', | ||
value: 'package', | ||
}, | ||
{ | ||
id: 'resource', | ||
key: 'resource', | ||
text: 'Knowledge Resource', | ||
value: 'resource', | ||
}, | ||
{ | ||
id: 'marketplace-item', | ||
key: 'marketplace-item', | ||
text: 'Commercial Item', | ||
value: 'marketplace-item', | ||
}, | ||
]} | ||
{...fieldProps} | ||
/> | ||
); | ||
}; | ||
|
||
RecordTypeField.propTypes = { | ||
fieldPath: PropTypes.string.isRequired, | ||
}; | ||
|
||
RecordTypeField.defaultProps = { | ||
fieldPath: 'metadata.record_type', | ||
label: ( | ||
<> | ||
<Icon name={'shopping bag'} /> {i18next.t('Record type')} | ||
</> | ||
), | ||
placeholder: i18next.t('Select a Record Type'), | ||
noQueryMessage: i18next.t('Start typing to search for a Record Type'), | ||
multiple: true, | ||
}; |
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
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
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
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