diff --git a/src/assets/minimap.png b/src/assets/minimap.png deleted file mode 100644 index 43c96882..00000000 Binary files a/src/assets/minimap.png and /dev/null differ diff --git a/src/components/Minimap/__tests__/Minimap.test.js b/src/components/Minimap/__tests__/Minimap.test.js deleted file mode 100644 index 64d93538..00000000 --- a/src/components/Minimap/__tests__/Minimap.test.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react' -import { render } from 'react-dom' -import { act } from 'react-dom/test-utils' -import Minimap from '..' - -import { minimap } from '../../../__fixtures__/minimap.js' - -it('renders props correctly', () => { - const div = document.createElement('div') - document.body.appendChild(div) - - act(() => { - render( - , div) - }) - -}) diff --git a/src/components/Minimap/index.js b/src/components/Minimap/index.js deleted file mode 100644 index 18b0f813..00000000 --- a/src/components/Minimap/index.js +++ /dev/null @@ -1,83 +0,0 @@ -import React, { useRef, useState } from 'react' -import PropTypes from 'prop-types' -import classnames from 'classnames' -import { appendParams } from '../Helpers' -import { useResizeObserver } from '../Hooks' -import './styles.scss' - -/** -* Minimap component -* 1. Uses a callback component so container height and width are set once ref resolves. -* 2. Create the correct number of blank boxes with start and end indexes. -* 3. Map hits onto blankBoxes array. -**/ -const Minimap = ({ data, isLoading, params, rowCount=4 }) => { - const [containerHeight, setContainerHeight] = useState(0) - const [containerWidth, setContainerWidth] = useState(0) - - const minimapContainer = useRef(null) - - const setDimensions = () => { - if (minimapContainer.current !== null) { - setContainerHeight(minimapContainer.current.getBoundingClientRect().height) - setContainerWidth(minimapContainer.current.getBoundingClientRect().width) - } - } - - useResizeObserver({ callback: setDimensions, element: minimapContainer }) - - const boxWidthHeight = containerWidth / rowCount - const totalBoxes = containerHeight && boxWidthHeight ? parseInt(parseInt(containerHeight) / boxWidthHeight) * rowCount : 0 - const hitsPerBox = data.total / totalBoxes - - const blankBoxes = Array(totalBoxes).fill().map((b, idx) => { /* 2 */ - const startIndex = hitsPerBox * idx - const endIndex = hitsPerBox * (idx + 1) - return ({start: startIndex, end: endIndex}) - }) - - const minimapBoxes = () => blankBoxes.map((b, idx) => { /* 3 */ - const areaHits = data.hits && data.hits.filter(h => (h.index <= b.end && b.start < h.index)) - .filter(h => h.uri.includes('objects')) - .sort((a, b) => a.index - b.index) - const hitClass = areaHits.filter(h => h.online).length ? 'minimap__digital-hit' : 'minimap__record-hit' - const hitTitles = areaHits.map(h => h.title).join('\n') - const currentUrl = window.location.pathname - const areaUrl = areaHits.length && areaHits[0].uri - const isAreaActive = areaUrl === currentUrl - return ( - areaHits.length ? - - {`Jump to ${areaHits.length} ${areaHits.length === 1 ? 'hit' : 'hits'} in this area: ${hitTitles}`} - - - : -
-
- ) - }) - const loadedBoxes = minimapBoxes() - - return ( - <> -

Minimap

- - -)} - -Minimap.propTypes = { - data: PropTypes.object.isRequired, - isLoading: PropTypes.bool.isRequired, - params: PropTypes.object.isRequired, - rowCount: PropTypes.number, -} - -export default Minimap diff --git a/src/components/Minimap/styles.scss b/src/components/Minimap/styles.scss deleted file mode 100644 index 43107f7f..00000000 --- a/src/components/Minimap/styles.scss +++ /dev/null @@ -1 +0,0 @@ -@import "../../styles/components/minimap"; diff --git a/src/components/MinimapButton/__tests__/MinimapButton.test.js b/src/components/MinimapButton/__tests__/MinimapButton.test.js deleted file mode 100644 index cc1819a0..00000000 --- a/src/components/MinimapButton/__tests__/MinimapButton.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react' -import { render } from 'react-dom' -import MinimapButton from '..' - -it('renders without crashing', () => { - const div = document.createElement('div') - render(, div) -}) diff --git a/src/components/MinimapButton/index.js b/src/components/MinimapButton/index.js deleted file mode 100644 index df5419c9..00000000 --- a/src/components/MinimapButton/index.js +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import minimapIcon from '../../assets/minimap.png' -import './styles.scss' - -const MinimapButton = ({ toggleMinimapModal }) => ( - -) - -MinimapButton.propTypes = { - toggleMinimapModal: PropTypes.func.isRequired, -} - -export default MinimapButton diff --git a/src/components/MinimapButton/styles.scss b/src/components/MinimapButton/styles.scss deleted file mode 100644 index d3972eb3..00000000 --- a/src/components/MinimapButton/styles.scss +++ /dev/null @@ -1 +0,0 @@ -@import "../../styles/components/minimap-button"; diff --git a/src/components/ModalMinimap/__tests__/ModalMinimap.test.js b/src/components/ModalMinimap/__tests__/ModalMinimap.test.js deleted file mode 100644 index 9c94a49c..00000000 --- a/src/components/ModalMinimap/__tests__/ModalMinimap.test.js +++ /dev/null @@ -1,52 +0,0 @@ -import React from 'react' -import { render, unmountComponentAtNode } from 'react-dom' -import { act } from 'react-dom/test-utils' -import { ModalMinimap } from '..' - -import { minimap } from '../../../__fixtures__/minimap.js' - -let container = null -beforeEach(() => { - container = document.createElement('div') - document.body.appendChild(container) -}) - -afterEach(() => { - unmountComponentAtNode(container) - container.remove() - container = null -}) - -it('renders props correctly', () => { - act(() => { - render(, container) - }) -}) - -it('handles clicks correctly', () => { - const toggleModal = jest.fn() - - act(() => { - render(, container) - }) - - const button = document.querySelector('.modal-header__button') - - act(() => { - button.dispatchEvent(new MouseEvent('click', { bubbles: true })) - }) - - expect(toggleModal).toHaveBeenCalledTimes(1) -}) diff --git a/src/components/ModalMinimap/__tests__/ModalMinimapInfo.test.js b/src/components/ModalMinimap/__tests__/ModalMinimapInfo.test.js deleted file mode 100644 index 858448ac..00000000 --- a/src/components/ModalMinimap/__tests__/ModalMinimapInfo.test.js +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react' -import { render, unmountComponentAtNode } from 'react-dom' -import { act } from 'react-dom/test-utils' -import { ModalMinimapInfo } from '..' - -let container = null -beforeEach(() => { - container = document.createElement('div') - document.body.appendChild(container) -}) - -afterEach(() => { - unmountComponentAtNode(container) - container.remove() - container = null -}) - -it('renders props correctly', () => { - act(() => { - render(, container) - }) -}) - -it('handles clicks correctly', () => { - const toggleModal = jest.fn() - - act(() => { - render(, container) - }) - - const button = document.querySelector('.modal-header__button') - - act(() => { - button.dispatchEvent(new MouseEvent('click', { bubbles: true })) - }) - - expect(toggleModal).toHaveBeenCalledTimes(1) -}) diff --git a/src/components/ModalMinimap/index.js b/src/components/ModalMinimap/index.js deleted file mode 100644 index 7a1f444c..00000000 --- a/src/components/ModalMinimap/index.js +++ /dev/null @@ -1,86 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import Modal from 'react-modal' -import MaterialIcon from '../MaterialIcon' -import Minimap from '../Minimap' -import './styles.scss' - -const minimapAboutText = <> -

Jump to a part of the collection containing matches by clicking on an active square.

-

In the minimap diagram, each square represents part of this collection. - Colored squares represent parts that contain one or more matches for your search.

- - -const minimapIntroText = <> -

The minimap is a new feature that allows you to quickly jump to search matches in a - collection by clicking on an active square.

-

In the minimap diagram, each square represents part of this collection. - Colored squares represent parts that contain one or more matches for your search.

- - -export const ModalMinimapInfo = props => ( - -
-

{ props.hasSeenMinimapIntro ? 'Minimap' : 'Introducing the Minimap' }

- -
-
- {props.hasSeenMinimapIntro ? minimapAboutText : minimapIntroText} -
-
-) - -ModalMinimapInfo.propTypes = { - appElement: PropTypes.object, - hasSeenMinimapIntro: PropTypes.bool.isRequired, - isOpen: PropTypes.bool.isRequired, - toggleModal: PropTypes.func.isRequired -} - -export const ModalMinimap = props => ( - -
-

Minimap

- -
-
- {minimapAboutText} -
- -
-
-
-) - -ModalMinimap.propTypes = { - appElement: PropTypes.object, - data: PropTypes.object.isRequired, - isLoading: PropTypes.bool.isRequired, - isOpen: PropTypes.bool.isRequired, - params: PropTypes.object, - rowCount: PropTypes.number, - toggleModal: PropTypes.func.isRequired -} diff --git a/src/components/ModalMinimap/styles.scss b/src/components/ModalMinimap/styles.scss deleted file mode 100644 index 28c5ff27..00000000 --- a/src/components/ModalMinimap/styles.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "../../styles/components/modal-base"; -@import "../../styles/components/modal-minimap"; diff --git a/src/styles/components/_minimap-button.scss b/src/styles/components/_minimap-button.scss deleted file mode 100644 index 4e1c987e..00000000 --- a/src/styles/components/_minimap-button.scss +++ /dev/null @@ -1,24 +0,0 @@ -@import "../variables/vars"; - -.btn--minimap { - display: flex !important; // TODO: this is BS - background: $off-white; - position: fixed; - top: 80px; - right: 30px; - z-index: 999; - @mixin md-up { - top: 90px; - } -} - -.btn--minimap__text { - width: 60px; - margin-left: 10px; - text-align: left; -} - -.btn--minimap__icon { - height: 30px; - width: 30px; -} diff --git a/src/styles/components/_minimap.scss b/src/styles/components/_minimap.scss deleted file mode 100644 index 9126ff19..00000000 --- a/src/styles/components/_minimap.scss +++ /dev/null @@ -1,167 +0,0 @@ -@import "../styles"; - -.minimap__wrapper { - width: $minimap-width; - height: calc(100vh - 60px); - float: left; - position: sticky; - top: 60px; - z-index: 998; -} - -.minimap__wrapper--modal { - width: 100%; - height: calc(100% - 72px); -} - -// ----------------------------------------------------------------------------- -// Below this line has been copied from the styles library, except where noted -// ----------------------------------------------------------------------------- - -@mixin on-event($self: false) { - @if $self { - &, - &:hover, - &:active, - &:focus { - @content; - } - } - - @else { - &:hover, - &:active, - &:focus { - @content; - } - } -} - -/** -* Creates classes .minimap--{{count}}-across that specify the number of -* 1fr grid-templates-columns between 1 and 20. For example, the -* .minimap--5-across class specifies 5 columns. For more than 20 -* columns, adjust the $grid-col-count variable. -* 1. min of 24px ensures WCAG AA spec for target area size. -**/ -$grid-col-count: 20; - -@mixin grid-col-count-class { - @for $count from 1 through $grid-col-count { - .minimap--#{$count}-across { - grid-template-columns: repeat($count, minmax(24px, 1fr)); /* 1 */ - } - } -} - -/** -* Mixin for minimap hit links with a "color" variable argument, including styles -* on hover, focus, or active events for minimap links. -* 1. Checkmark for visited links is located in the top right corner of the the box. -* 2. Styles for checkmark, which is visible via a color change once link is active -* or has been visited. -**/ -@mixin minimap-hit($color) { - background: $color; - color: $color; - display: flex; /* 1 */ - justify-content: flex-end; /* 1 */ - text-decoration: none; - margin: 0; // added - - @include on-event { - border: 2px solid darken($color, 22%); - color: $color; - outline: none; - text-decoration: none; - transform: scale(1.3); - } - - .material-icons { // class name changed - align-self: flex-start; /* 1 */ - font-size: 12px; /* 2 */ - } - - &:visited { - background-color: darken($color, 10%); - color: $pure-white; /* 2 */ - } -} - -/** -* Mixin for minimap hit links that are currently active with a "color" variable argument. -**/ -@mixin minimap-hit-active ($color) { - border: 3px solid darken($color, 22%); - color: $pure-white; - - @include lg-up { - border: 2px solid darken($color, 22%); - } - - @include on-event { - color: $pure-white; - } -} - -/** -* Styles for minimap that uses grid display. On medium and small screens, styles -* assume the minimap will be inside of a modal. -* 1. Increases gutter space between grid items on small screens. -**/ -.minimap { - align-content: start; - display: grid; - float: left; - gap: 8px; /* 1 */ - grid-template-rows: auto; - height: 100%; - width: 100%; - z-index: 998; - - @include lg-up { - gap: 1px; /* 1 */ - } -} - -/** -* Includes the classes to specify grid-template-columns number -**/ -@include grid-col-count-class; - -/** -* Styles for the minimap grid item boxes. -* 1. Ensures that the boxes are square. -**/ -.minimap__box { - aspect-ratio: 1/1; /* 1 */ - background-color: $neutral-sand; - border-radius: 3px; - box-sizing: border-box; - - @include lg-up { - border-radius: 2px; - } -} - -/** -* Styles for the minimap links. -**/ -.minimap__digital-hit { - @include minimap-hit($deep-blue); -} - -.minimap__record-hit { - @include minimap-hit($burnt-orange); -} - -/** -* Styles for the minimap links that are currently active. -**/ -.minimap__digital-hit--active { - @include minimap-hit-active($deep-blue); -} - -.minimap__record-hit--active { - @include minimap-hit-active ($burnt-orange); -} diff --git a/src/styles/components/_modal-minimap.scss b/src/styles/components/_modal-minimap.scss deleted file mode 100644 index 83b28472..00000000 --- a/src/styles/components/_modal-minimap.scss +++ /dev/null @@ -1,60 +0,0 @@ -.modal-content { - font-family: $sans-serif-stack; - position: absolute; - border: 1px solid $dark-gray; - background: rgb(255, 255, 255); - border-radius: 3px; - overflow: auto; - outline: none; -} - -.modal-content--minimap { - @extend .modal-content; - top: 60px; - bottom: 0; - left: 0; - right: 0; - @include md-up { - top: 70px; - right: 0; - left: 50%; - } -} - -.modal-content--minimap-info { - @extend .modal-content; - top: 70px; - right: 40px; - left: 40px; - bottom: unset; - @include md-up { - top: 100px; - right: 25%; - left: 25%; - } - @include lg-up { - top: 80px; - left: 10%; - right: calc(63% + 20px); - } -} - -.modal-header--minimap { - background-color: $pure-white; - margin: 14px; -} - -.modal-header__title--minimap { - @extend .modal-header__title; - font-size: 12px; - text-transform: uppercase; - letter-spacing: 3px; - padding-left: 11px; - padding-top: 5px; -} - -.modal-body--minimap { - padding: 24px; - font-size: 13px; - height: calc(100% - 23px); -}