-
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 #443 from mlibrary/class-component-conversions-part-3
Class component conversions part 3
- Loading branch information
Showing
26 changed files
with
294 additions
and
622 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
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
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,56 @@ | ||
import React from 'react'; | ||
import { Alert } from '../../../reusable'; | ||
import GetThisOption from '../GetThisOption'; | ||
import { Authentication } from '../../../profile'; | ||
import PropTypes from 'prop-types'; | ||
|
||
function GetThisOptions ({ record }) { | ||
if (!record?.getthis) { | ||
return ( | ||
<Alert> | ||
<p>Loading holding options...</p> | ||
</Alert> | ||
); | ||
} | ||
|
||
const { status, options } = record.getthis; | ||
|
||
if (status === 'Not logged in') { | ||
return ( | ||
<Authentication button> | ||
<span className='strong'>Log in</span> to view request options | ||
</Authentication> | ||
); | ||
} | ||
|
||
if (status === 'Success') { | ||
return options?.length | ||
? ( | ||
<> | ||
{options.map((option, index) => { | ||
return ( | ||
<GetThisOption option={option} key={index} /> | ||
); | ||
})} | ||
</> | ||
) | ||
: ( | ||
<Alert type='error'> | ||
No options available. | ||
</Alert> | ||
); | ||
} | ||
|
||
return ( | ||
<Alert> | ||
<p>Sorry, something unexpected happened.</p> | ||
<p><span className='strong'>Status:</span> {status}</p> | ||
</Alert> | ||
); | ||
} | ||
|
||
GetThisOptions.propTypes = { | ||
record: PropTypes.object.isRequired | ||
}; | ||
|
||
export default GetThisOptions; |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import GetThisForm from './components/GetThisForm'; | ||
import GetThisOptions from './components/GetThisOptions'; | ||
import GetThisPage from './components/GetThisPage'; | ||
import GetThisOptionList from './components/GetThisOptionList'; | ||
import GetThisRecord from './components/GetThisRecord'; | ||
import GetThisForm from './components/GetThisForm'; | ||
|
||
export { | ||
GetThisForm, | ||
GetThisOptions, | ||
GetThisPage, | ||
GetThisOptionList, | ||
GetThisRecord, | ||
GetThisForm | ||
GetThisRecord | ||
}; |
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
Oops, something went wrong.