Skip to content

Commit 3930da8

Browse files
authored
Merge pull request #4072 from ProjectMirador/prop-warnings
Get rid of some prop type console warnings
2 parents f04609f + 1b4c943 commit 3930da8

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/components/IIIFAuthentication.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ import WindowAuthenticationBar from '../containers/WindowAuthenticationBar';
88
* Opens a new window for click
99
*/
1010
export function IIIFAuthentication({
11-
accessTokenServiceId, authServiceId, confirm = undefined, description = undefined,
11+
accessTokenServiceId = undefined, authServiceId = undefined, confirm = undefined, description = undefined,
1212
failureDescription = undefined, failureHeader = undefined, features = 'centerscreen',
1313
handleAuthInteraction, header = undefined, isInteractive = true, label = undefined,
1414
logoutConfirm = undefined, logoutServiceId = undefined, openWindow = window.open,
1515
resetAuthenticationState, resolveAccessTokenRequest, resolveAuthenticationRequest,
1616
status = null, windowId,
1717
}) {
1818
const { t } = useTranslation();
19+
20+
if (!accessTokenServiceId || !authServiceId) return null;
21+
1922
/** */
2023
const onReceiveAccessTokenMessage = (payload) => {
2124
resolveAccessTokenRequest(authServiceId, accessTokenServiceId, payload);
@@ -95,8 +98,6 @@ export function IIIFAuthentication({
9598
);
9699
};
97100

98-
if (!authServiceId) return null;
99-
100101
if (status === null) return renderLogin();
101102
if (status === 'cookie') return renderLoggingInCookie();
102103
if (status === 'token') return renderLoggingInToken();
@@ -107,8 +108,8 @@ export function IIIFAuthentication({
107108
}
108109

109110
IIIFAuthentication.propTypes = {
110-
accessTokenServiceId: PropTypes.string.isRequired,
111-
authServiceId: PropTypes.string.isRequired,
111+
accessTokenServiceId: PropTypes.string,
112+
authServiceId: PropTypes.string,
112113
confirm: PropTypes.string,
113114
description: PropTypes.string,
114115
failureDescription: PropTypes.string,

src/components/IIIFThumbnail.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const Image = styled('img', { name: 'IIIFThumbnail', slot: 'image' })(() => ({
2323
*/
2424
const LazyLoadedImage = ({
2525
border = false, placeholder, style = {}, thumbnail = null,
26-
resource, maxHeight, maxWidth, thumbnailsConfig = {}, ...props
26+
resource, maxHeight = null, maxWidth = null, thumbnailsConfig = {}, ...props
2727
}) => {
2828
const { ref, inView } = useInView();
2929
const [loaded, setLoaded] = useState(false);
@@ -117,8 +117,8 @@ const LazyLoadedImage = ({
117117

118118
LazyLoadedImage.propTypes = {
119119
border: PropTypes.bool,
120-
maxHeight: PropTypes.number.isRequired,
121-
maxWidth: PropTypes.number.isRequired,
120+
maxHeight: PropTypes.number,
121+
maxWidth: PropTypes.number,
122122
placeholder: PropTypes.string.isRequired,
123123
resource: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
124124
style: PropTypes.object, // eslint-disable-line react/forbid-prop-types

src/components/WindowSideBarButtons.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ WindowSideBarButtons.propTypes = {
171171
hasCurrentLayers: PropTypes.bool,
172172
hasSearchResults: PropTypes.bool,
173173
hasSearchService: PropTypes.bool,
174-
panels: PropTypes.arrayOf(PropTypes.bool),
174+
panels: PropTypes.objectOf(PropTypes.bool),
175175
PluginComponents: PropTypes.array, // eslint-disable-line react/forbid-prop-types
176176
sideBarPanel: PropTypes.string,
177177
};

0 commit comments

Comments
 (0)