forked from ProjectMirador/mirador
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextViewer.js
More file actions
37 lines (33 loc) · 1.17 KB
/
TextViewer.js
File metadata and controls
37 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { styled } from '@mui/material/styles';
import PropTypes from 'prop-types';
import WindowCanvasNavigationControls from '../containers/WindowCanvasNavigationControls';
const StyledContainer = styled('div')(() => ({
alignItems: 'center',
display: 'flex',
width: '100%',
}));
const StyledText = styled('div')(() => ({
maxHeight: '100%',
width: '100%',
}));
/**
* Simple divs with canvas navigation, which should mimic v3 fallthrough to WindowViewer
* with non-image resources and provide a target for plugin overrides with minimal disruption.
*/
export function TextViewer({ textOptions = {}, textResources = [], windowId }) {
return (
<StyledContainer>
<StyledText {...textOptions}>
{textResources.map(text => (
<source key={text.id} src={text.id} type={text.getFormat()} />
))}
<WindowCanvasNavigationControls windowId={windowId} />
</StyledText>
</StyledContainer>
);
}
TextViewer.propTypes = {
textOptions: PropTypes.object, // eslint-disable-line react/forbid-prop-types
textResources: PropTypes.arrayOf(PropTypes.object), // eslint-disable-line react/forbid-prop-types
windowId: PropTypes.string.isRequired,
};