UNPKG

@jbrowse/plugin-linear-genome-view

Version:

JBrowse 2 linear genome view

23 lines (22 loc) 1.48 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { observer } from 'mobx-react'; import { ContentBlock as ContentBlockComponent, ElidedBlock as ElidedBlockComponent, InterRegionPaddingBlock as InterRegionPaddingBlockComponent, } from './Block'; import MaxHeightReached from './MaxHeightReachedIndicator'; const RenderedBlocks = observer(function ({ model, }) { const { blockDefinitions, blockState } = model; return blockDefinitions.map(block => { const key = `${model.id}-${block.key}`; if (block.type === 'ContentBlock') { const state = blockState.get(block.key); return (_jsxs(ContentBlockComponent, { block: block, children: [(state === null || state === void 0 ? void 0 : state.ReactComponent) ? (_jsx(state.ReactComponent, { model: state })) : null, (state === null || state === void 0 ? void 0 : state.maxHeightReached) ? (_jsx(MaxHeightReached, { top: state.layout.getTotalHeight() - 16 })) : null] }, key)); } else if (block.type === 'ElidedBlock') { return _jsx(ElidedBlockComponent, { width: block.widthPx }, key); } else if (block.type === 'InterRegionPaddingBlock') { return (_jsx(InterRegionPaddingBlockComponent, { width: block.widthPx, style: { background: 'none' }, boundary: block.variant === 'boundary' }, key)); } throw new Error(`invalid block type ${JSON.stringify(block)}`); }); }); export default RenderedBlocks;