diff --git a/.github/PULL_REQUEST_TEMPLATE/dependency_updates_template.md b/.github/PULL_REQUEST_TEMPLATE/dependency_updates_template.md index 1a948737b..c8958f93d 100644 --- a/.github/PULL_REQUEST_TEMPLATE/dependency_updates_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/dependency_updates_template.md @@ -8,7 +8,6 @@ These dependencies have been updated to their latest versions: - `@redux-devtools/extension` - `@reduxjs/toolkit` - `citeproc` -- `classnames` - `connected-react-router` - `core-js` - `eslint` diff --git a/package-lock.json b/package-lock.json index 3e999e0d5..b570f098d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "@redux-devtools/extension": "^3.3.0", "@reduxjs/toolkit": "^2.2.1", "citeproc": "^2.4.63", - "classnames": "^2.5.1", "connected-react-router": "^6.9.3", "core-js": "^3.36.0", "history": "^4.10.1", @@ -6317,11 +6316,6 @@ "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", "dev": true }, - "node_modules/classnames": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", - "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==" - }, "node_modules/clean-css": { "version": "5.3.3", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz", diff --git a/package.json b/package.json index 4f2b64418..35debdd96 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "@redux-devtools/extension": "^3.3.0", "@reduxjs/toolkit": "^2.2.1", "citeproc": "^2.4.63", - "classnames": "^2.5.1", "connected-react-router": "^6.9.3", "core-js": "^3.36.0", "history": "^4.10.1", diff --git a/src/modules/advanced/components/AdvancedSearchForm/index.js b/src/modules/advanced/components/AdvancedSearchForm/index.js index 8188d951d..a2fa0ae7a 100644 --- a/src/modules/advanced/components/AdvancedSearchForm/index.js +++ b/src/modules/advanced/components/AdvancedSearchForm/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { Icon, Button, Alert } from '../../../reusable'; +import { Icon, Alert } from '../../../reusable'; import { withRouter } from 'react-router-dom'; import FieldInput from '../FieldInput'; import FiltersContainer from '../FiltersContainer'; @@ -35,7 +35,8 @@ class AdvancedSearchForm extends React.Component { }); }; - handleAddAnotherFieldedSearch = () => { + handleAddAnotherFieldedSearch = (e) => { + e.preventDefault(); this.props.addFieldedSearch({ datastoreUid: this.props.datastore.uid, field: this.props.fields[0].uid @@ -176,18 +177,21 @@ class AdvancedSearchForm extends React.Component { justifyContent: 'space-around' }} > - + - + diff --git a/src/modules/advanced/components/FiltersContainer/index.js b/src/modules/advanced/components/FiltersContainer/index.js index a2e063048..47f6b5666 100644 --- a/src/modules/advanced/components/FiltersContainer/index.js +++ b/src/modules/advanced/components/FiltersContainer/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { useSelector, connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import PropTypes from 'prop-types'; -import { Icon, Button } from '../../../reusable'; +import { Icon } from '../../../reusable'; import getFilters from './getFilters'; import AdvancedFilter from '../AdvancedFilter'; import { setAdvancedFilter } from '../../../advanced'; @@ -128,12 +128,13 @@ class FiltersContainer extends React.Component { })} - + ); } diff --git a/src/modules/affiliation/components/choose-affiliation.js b/src/modules/affiliation/components/choose-affiliation.js index 278be951e..3ec778b85 100644 --- a/src/modules/affiliation/components/choose-affiliation.js +++ b/src/modules/affiliation/components/choose-affiliation.js @@ -4,7 +4,7 @@ import { useCookies } from 'react-cookie'; import { useSelector } from 'react-redux'; import qs from 'qs'; import { COLORS } from '../../reusable/umich-lib-core-temp'; -import { Button, Dialog } from '../../reusable'; +import { Dialog } from '../../reusable'; export default function ChooseAffiliation () { const { defaultAffiliation, affiliationOptions } = useSelector((state) => { @@ -61,8 +61,8 @@ export default function ChooseAffiliation () { if (oldSafari) { return (
-
- + ); } return (
-
- +
- + or - +

You can still use Library Search if you're not affiliated with either campus.

- +
diff --git a/src/modules/datastores/components/DatastoreAlerts/index.js b/src/modules/datastores/components/DatastoreAlerts/index.js index 44ee9e292..c83ad7102 100644 --- a/src/modules/datastores/components/DatastoreAlerts/index.js +++ b/src/modules/datastores/components/DatastoreAlerts/index.js @@ -6,7 +6,7 @@ import { COLORS, Margins } from '../../../reusable/umich-lib-core-temp'; -import { Anchor, Button, Icon } from '../../../reusable/'; +import { Anchor, Icon } from '../../../reusable/'; function COVIDAlert () { const [dismissed, setDismissed] = useState(false); @@ -47,17 +47,17 @@ function COVIDAlert () {

Log in to view Get This options for items in our catalog while building access is limited. Learn more about access changes due to COVID-19.

- + ); diff --git a/src/modules/datastores/components/FlintAlerts/index.js b/src/modules/datastores/components/FlintAlerts/index.js index 092044288..55b6b51b1 100644 --- a/src/modules/datastores/components/FlintAlerts/index.js +++ b/src/modules/datastores/components/FlintAlerts/index.js @@ -1,34 +1,35 @@ import React, { useState } from 'react'; -import { Alert, Anchor, Button } from '../../../reusable'; +import { Alert, Anchor } from '../../../reusable'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -function FlintAlerts (props) { - const [closed, setClosed] = useState(false); - const datastores = ['primo', 'databases', 'onlinejournals', 'website']; +function FlintAlerts ({ datastore, profile }) { + const [dismiss, setDismiss] = useState([]); + const handleDismissClick = () => { + setDismiss((previousDismiss) => { + return [...previousDismiss, datastore]; + }); + }; + const messages = { + primo: (<>U-M Flint users: You may not be able to access U-M Ann Arbor resources. For the best results use Thompson Library’s Search All to search for articles.), + databases: (<>We noticed you are affiliated with U-M Flint. For the best results use the Thompson Library’s database listing.), + onlinejournals: (<>We noticed you are affiliated with U-M Flint. For the best results use the Thompson Library’s Search All to search for articles.), + website: (<>We noticed you are affiliated with U-M Flint. For the best results use the Thompson Library website.) + }; - if (!datastores.includes(props.datastore) || !props.profile.institutions?.includes('Flint') || closed) { + if (!Object.keys(messages).includes(datastore) || !profile.institutions?.includes('Flint') || dismiss.includes(datastore)) { return null; } return ( - - {props.datastore === datastores[0] && <>U-M Flint users: You may not be able to access U-M Ann Arbor resources. For the best results use Thompson Library’s Search All to search for articles.} - {props.datastore === datastores[1] && <>We noticed you are affiliated with U-M Flint. For the best results use the Thompson Library’s database listing.} - {props.datastore === datastores[2] && <>We noticed you are affiliated with U-M Flint. For the best results use the Thompson Library’s Search All to search for articles.} - {props.datastore === datastores[3] && <>We noticed you are affiliated with U-M Flint. For the best results use the Thompson Library website.} - - + ); } @@ -38,10 +39,8 @@ FlintAlerts.propTypes = { datastore: PropTypes.string }; -function mapStateToProps (state) { +export default connect((state) => { return { profile: state.profile }; -} - -export default connect(mapStateToProps)(FlintAlerts); +})(FlintAlerts); diff --git a/src/modules/filters/components/Filters/index.js b/src/modules/filters/components/Filters/index.js index 30d8654da..4409265d9 100644 --- a/src/modules/filters/components/Filters/index.js +++ b/src/modules/filters/components/Filters/index.js @@ -353,8 +353,6 @@ function FilterGroupFilters ({ group, hidden = false, filters }) { These citations are generated from a variety of data sources. Remember to check citation format and content for accuracy before including them in your work.

- + ) : ( diff --git a/src/modules/lists/components/EmailAction/index.js b/src/modules/lists/components/EmailAction/index.js index bfb84b88b..baa5ee344 100644 --- a/src/modules/lists/components/EmailAction/index.js +++ b/src/modules/lists/components/EmailAction/index.js @@ -1,6 +1,5 @@ import React, { useState } from 'react'; import ActionStatusMessage from '../ActionStatusMessage'; -import { Button } from '../../../reusable'; import PropTypes from 'prop-types'; function EmailAction (props) { @@ -40,7 +39,13 @@ function EmailAction (props) { autoComplete='on' /> - + } ); diff --git a/src/modules/lists/components/FileAction/index.js b/src/modules/lists/components/FileAction/index.js index 2d739125d..ca8c63f9d 100644 --- a/src/modules/lists/components/FileAction/index.js +++ b/src/modules/lists/components/FileAction/index.js @@ -1,24 +1,18 @@ import React from 'react'; -import { Button } from '../../../reusable'; import PropTypes from 'prop-types'; -function FileAction (props) { +function FileAction ({ prejudice, datastore }) { return (
{ event.preventDefault(); - props.prejudice.act( - 'file', - props.datastore.uid, - 'export-ris', - () => { - // Must have a function for callback - } - ); + prejudice.act('file', datastore.uid, 'export-ris', () => { /** Callback must be a function */ }); }} > - +
); diff --git a/src/modules/lists/components/PermalinkAction/index.js b/src/modules/lists/components/PermalinkAction/index.js index ed0240d2a..360b554fe 100644 --- a/src/modules/lists/components/PermalinkAction/index.js +++ b/src/modules/lists/components/PermalinkAction/index.js @@ -1,5 +1,4 @@ import React from 'react'; -import { Button } from '../../../reusable'; import PropTypes from 'prop-types'; function PermalinkAction (props) { @@ -29,9 +28,9 @@ function PermalinkAction (props) { autoComplete='off' /> - + ); } diff --git a/src/modules/lists/components/TextAction/index.js b/src/modules/lists/components/TextAction/index.js index 70135009e..424fb95ad 100644 --- a/src/modules/lists/components/TextAction/index.js +++ b/src/modules/lists/components/TextAction/index.js @@ -1,6 +1,5 @@ import React, { useState } from 'react'; import ActionStatusMessage from '../ActionStatusMessage'; -import { Button } from '../../../reusable'; import PropTypes from 'prop-types'; function TextAction (props) { @@ -43,7 +42,13 @@ function TextAction (props) { /> Please enter using this format: 000-111-5555 - + } ); diff --git a/src/modules/records/components/ViewMARC/index.js b/src/modules/records/components/ViewMARC/index.js index 8a5324238..7cc7df102 100644 --- a/src/modules/records/components/ViewMARC/index.js +++ b/src/modules/records/components/ViewMARC/index.js @@ -1,44 +1,36 @@ -import React from 'react'; -import { Button } from '../../../reusable'; +import React, { useState } from 'react'; import { getField, getFieldValue } from '../../utilities'; import { MARCTable } from '../../../marc'; import PropTypes from 'prop-types'; -class ViewMARC extends React.Component { - state = { - view: false - }; +const ViewMARC = ({ record }) => { + const [view, setView] = useState(false); + const marc = getFieldValue(getField(record.fields, 'marc_record'))[0]; - render () { - const { record } = this.props; - const { view } = this.state; - const marc = getFieldValue(getField(record.fields, 'marc_record'))[0]; - - if (marc) { - if (view) { - return ; - } else { - return ( -
- -
- ); - } + if (marc) { + if (view) { + return ; } - return null; + return ( +
+ +
+ ); } -} + + return null; +}; ViewMARC.propTypes = { - record: PropTypes.object + record: PropTypes.object.isRequired }; export default ViewMARC; diff --git a/src/modules/resource-acccess/components/holder.js b/src/modules/resource-acccess/components/holder.js index de715ce0d..4d9c47974 100644 --- a/src/modules/resource-acccess/components/holder.js +++ b/src/modules/resource-acccess/components/holder.js @@ -163,7 +163,7 @@ function HolderRows ({ rows }) { wordBreak: 'break-word' }} > - + ); diff --git a/src/modules/resource-acccess/components/holding.js b/src/modules/resource-acccess/components/holding.js index 8de1e6707..e66175508 100644 --- a/src/modules/resource-acccess/components/holding.js +++ b/src/modules/resource-acccess/components/holding.js @@ -1,7 +1,7 @@ /** @jsxImportSource @emotion/react */ import React from 'react'; import { INTENT_COLORS } from '../../reusable/umich-lib-core-temp'; -import { Anchor, Icon, Button } from '../../reusable'; +import { Anchor, Icon } from '../../reusable'; import PropTypes from 'prop-types'; function Cell ({ cell }) { @@ -68,16 +68,15 @@ class TrimCellText extends React.Component { return ( <> {displayText} - + ); } diff --git a/src/modules/reusable/components/Button/Button.js b/src/modules/reusable/components/Button/Button.js deleted file mode 100644 index bbd260500..000000000 --- a/src/modules/reusable/components/Button/Button.js +++ /dev/null @@ -1,55 +0,0 @@ -import React from 'react'; -import classNames from 'classnames'; -import PropTypes from 'prop-types'; - -const Button = ({ - children, - disabled, - className, - kind, - type, - small, - ...other -}) => { - const buttonClasses = classNames(className, { - btn: true, - 'btn--small': small, - 'btn--start': kind === 'start', - 'btn--primary': kind === 'primary', - 'btn--secondary': kind === 'secondary', - 'btn--tertiary': kind === 'tertiary' - }); - - const commonProps = { - className: buttonClasses - }; - - return ( - - ); -}; - -Button.propTypes = { - children: PropTypes.node, - className: PropTypes.string, - disabled: PropTypes.bool, - small: PropTypes.bool, - kind: PropTypes.oneOf([ - 'start', - 'primary', - 'secondary', - 'tertiary' - ]).isRequired, - type: PropTypes.oneOf(['button', 'reset', 'submit']) -}; - -Button.defaultProps = { - type: 'button', - disabled: false, - small: false, - kind: 'primary' -}; - -export default Button; diff --git a/src/modules/reusable/components/Button/index.js b/src/modules/reusable/components/Button/index.js deleted file mode 100644 index 4ae846f77..000000000 --- a/src/modules/reusable/components/Button/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import Button from './Button'; -export default Button; diff --git a/src/modules/reusable/components/Expandable/ExpandableButton.js b/src/modules/reusable/components/Expandable/ExpandableButton.js index 416a1e1c6..22210712c 100644 --- a/src/modules/reusable/components/Expandable/ExpandableButton.js +++ b/src/modules/reusable/components/Expandable/ExpandableButton.js @@ -1,6 +1,5 @@ import React, { Component } from 'react'; import { ExpandableContext } from './Expandable'; -import { Button } from '../../../reusable'; import PropTypes from 'prop-types'; const cleanList = (list) => { @@ -18,8 +17,10 @@ class ExpandableButton extends Component { } return ( - + ); } } diff --git a/src/modules/reusable/components/Metadata/index.js b/src/modules/reusable/components/Metadata/index.js index a11fb6fad..87267fc43 100644 --- a/src/modules/reusable/components/Metadata/index.js +++ b/src/modules/reusable/components/Metadata/index.js @@ -111,8 +111,6 @@ export default function Metadata ({ data, kind }) { {displayText} - + ); } @@ -240,7 +238,7 @@ class ResourceAccess extends React.Component { {rows.length > 6 && ( - + )} @@ -267,7 +265,7 @@ class ResourceAccess extends React.Component { ? ( - + ) diff --git a/src/modules/reusable/index.js b/src/modules/reusable/index.js index 9958714fb..1414bd8dd 100644 --- a/src/modules/reusable/index.js +++ b/src/modules/reusable/index.js @@ -1,7 +1,6 @@ import Alert from './components/Alert'; import Anchor from './components/Anchor'; import Breadcrumb from './components/Breadcrumb'; -import Button from './components/Button'; import ContextProvider from './components/ContextProvider'; import Dialog from './components/Dialog'; import { Expandable, ExpandableButton, ExpandableChildren, ExpandableProvider } from './components/Expandable'; @@ -15,7 +14,6 @@ export { Alert, Anchor, Breadcrumb, - Button, ContextProvider, Dialog, Expandable, diff --git a/src/modules/search/components/SearchBox/index.js b/src/modules/search/components/SearchBox/index.js index 8e69a10df..4d6e7a008 100644 --- a/src/modules/search/components/SearchBox/index.js +++ b/src/modules/search/components/SearchBox/index.js @@ -3,7 +3,7 @@ import { Global } from '@emotion/react'; import React, { useState, useEffect } from 'react'; import { useSelector } from 'react-redux'; import { MEDIA_QUERIES, SEARCH_COLORS } from '../../../reusable/umich-lib-core-temp'; -import { Anchor, Icon, Button } from '../../../reusable'; +import { Anchor, Icon } from '../../../reusable'; import qs from 'qs'; import SearchByOptions from '../SearchByOptions'; import SearchTip from '../SearchTip'; @@ -250,7 +250,8 @@ function SearchBox ({ history, match, location }) { } }} /> - + {isAdvanced && (