diff --git a/package.json b/package.json index 1b663cf5..1591fa3a 100644 --- a/package.json +++ b/package.json @@ -105,8 +105,7 @@ "react-final-form": "^6.3.0", "react-final-form-arrays": "^3.1.0", "react-final-form-listeners": "^1.0.2", - "react-router-prop-types": "^1.0.4", - "react-titled": "^2.0.0" + "react-router-prop-types": "^1.0.4" }, "peerDependencies": { "@folio/stripes": "^9.0.0", diff --git a/src/BursarExportPlugin.tsx b/src/BursarExportPlugin.tsx index c94907e9..a20fbc49 100644 --- a/src/BursarExportPlugin.tsx +++ b/src/BursarExportPlugin.tsx @@ -1,5 +1,5 @@ import { Button, LoadingPane, Pane, PaneFooter } from '@folio/stripes/components'; -import { useStripes } from '@folio/stripes/core'; +import { useStripes, TitleManager } from '@folio/stripes/core'; import { FormApi } from 'final-form'; import React, { useCallback, useRef } from 'react'; import { FormattedMessage, useIntl } from 'react-intl'; @@ -9,7 +9,6 @@ import ConfigurationForm from './components/ConfigurationForm'; import { FORM_ID } from './constants'; import useInitialValues from './hooks/useInitialValues'; import { FormValues } from './types'; -import TitleManager from './components/TitleManager/TitleManager'; export default function BursarExportPlugin() { const intl = useIntl(); @@ -73,7 +72,7 @@ export default function BursarExportPlugin() { } return ( - + { - static defaultProps: Partial = { prefix: '' }; - - renderTitle = (currentTitle: string | undefined) => { - const { prefix = '', page, record } = this.props; - - if (typeof currentTitle !== 'string') return ''; - - const tokens = currentTitle.split(' - '); - - if (tokens.length === 2) { - tokens[1] = ''; - } - - if (page) tokens[0] = page; - if (record) tokens[1] = record; - - return prefix + tokens.filter(t => t).join(' - '); - }; - - render() { - return ( - - {this.props.children} - - ); - } -} - -export default TitleManager; diff --git a/test/__mocks__/stripes-core.mock.ts b/test/__mocks__/stripes-core.mock.ts index 3ea74abc..b5678615 100644 --- a/test/__mocks__/stripes-core.mock.ts +++ b/test/__mocks__/stripes-core.mock.ts @@ -19,6 +19,7 @@ jest.mock('@folio/stripes/core', () => { } }), Pluggable: jest.fn(({ children }) => [children]), + TitleManager: jest.fn(({ children }) => children), useOkapiKy: jest.fn(), useStripes: jest.fn(() => STRIPES), };