diff --git a/docs/source/upgrade-guide/index.md b/docs/source/upgrade-guide/index.md index f32722b858..e71c1357b4 100644 --- a/docs/source/upgrade-guide/index.md +++ b/docs/source/upgrade-guide/index.md @@ -371,6 +371,11 @@ This change is needed for consistency with module suffixes in Volto core, in pre It is unlikely that your code uses it, unless you heavily customized the Jest testing pipeline. +### Remove `react-share` library and `SocialSharing` component + +This was not used by the core since some time ago, and nowadays is more suitable for being an add-on and not being included in core. +If you still use it, bring it back as your main add-on dependency, bring back the `SocialSharing` component from Volto 17 as a custom component in your add-on code. + (volto-upgrade-guide-17.x.x)= ## Upgrading to Volto 17.x.x diff --git a/packages/volto/news/6162.breaking b/packages/volto/news/6162.breaking new file mode 100644 index 0000000000..fd2f5b36bd --- /dev/null +++ b/packages/volto/news/6162.breaking @@ -0,0 +1 @@ +Remove `react-share` library and `SocialSharing` component @sneridagh diff --git a/packages/volto/package.json b/packages/volto/package.json index 1d6732e1d7..f688a23ea7 100644 --- a/packages/volto/package.json +++ b/packages/volto/package.json @@ -240,7 +240,6 @@ "react-router-hash-link": "2.4.3", "react-select": "4.3.1", "react-select-async-paginate": "0.5.3", - "react-share": "2.3.1", "react-side-effect": "2.1.2", "react-simple-code-editor": "0.7.1", "react-sortable-hoc": "2.0.0", diff --git a/packages/volto/src/components/index.js b/packages/volto/src/components/index.js index bcd0f9a8f8..11444c6a1f 100644 --- a/packages/volto/src/components/index.js +++ b/packages/volto/src/components/index.js @@ -49,7 +49,6 @@ export { default as Logout } from '@plone/volto/components/theme/Logout/Logout'; export { default as Sitemap } from '@plone/volto/components/theme/Sitemap/Sitemap'; export { default as Search } from '@plone/volto/components/theme/Search/Search'; export { default as Comments } from '@plone/volto/components/theme/Comments/Comments'; -export { default as SocialSharing } from '@plone/volto/components/theme/SocialSharing/SocialSharing'; export { default as Register } from '@plone/volto/components/theme/Register/Register'; export { default as PasswordReset } from '@plone/volto/components/theme/PasswordReset/PasswordReset'; export { default as RequestPasswordReset } from '@plone/volto/components/theme/PasswordReset/RequestPasswordReset'; diff --git a/packages/volto/src/components/theme/SocialSharing/SocialSharing.jsx b/packages/volto/src/components/theme/SocialSharing/SocialSharing.jsx deleted file mode 100644 index 3c3d72f98f..0000000000 --- a/packages/volto/src/components/theme/SocialSharing/SocialSharing.jsx +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Social sharing component. - * @module components/theme/SocialSharing/SocialSharing - */ - -import React from 'react'; -import PropTypes from 'prop-types'; -import { Button, Container } from 'semantic-ui-react'; -import { FacebookShareButton, TwitterShareButton } from 'react-share'; - -/** - * Social sharing component class. - * @function SocialSharing - * @param {string} url Url to share. - * @param {string} title Title of the content. - * @param {string} description Description of the content. - * @returns {string} Markup of the component. - */ -const SocialSharing = ({ url, title, description }) => ( - -
- - - - - - -
-
-
-); - -/** - * Property types. - * @property {Object} propTypes Property types. - * @static - */ -SocialSharing.propTypes = { - url: PropTypes.string.isRequired, - title: PropTypes.string.isRequired, - description: PropTypes.string.isRequired, -}; - -export default SocialSharing; diff --git a/packages/volto/src/components/theme/SocialSharing/SocialSharing.test.jsx b/packages/volto/src/components/theme/SocialSharing/SocialSharing.test.jsx deleted file mode 100644 index dcb804cfd2..0000000000 --- a/packages/volto/src/components/theme/SocialSharing/SocialSharing.test.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import renderer from 'react-test-renderer'; - -import SocialSharing from './SocialSharing'; - -describe('SocialSharing', () => { - it('renders a social sharing component', () => { - const component = renderer.create( - , - ); - const json = component.toJSON(); - expect(json).toMatchSnapshot(); - }); -}); diff --git a/packages/volto/src/components/theme/SocialSharing/__snapshots__/SocialSharing.test.jsx.snap b/packages/volto/src/components/theme/SocialSharing/__snapshots__/SocialSharing.test.jsx.snap deleted file mode 100644 index 5d9e15d1b6..0000000000 --- a/packages/volto/src/components/theme/SocialSharing/__snapshots__/SocialSharing.test.jsx.snap +++ /dev/null @@ -1,46 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`SocialSharing renders a social sharing component 1`] = ` -
-
-
- -
-
- -
-
-
-
-`; diff --git a/packages/volto/src/components/theme/View/View.jsx b/packages/volto/src/components/theme/View/View.jsx index 132c528c3a..36c0341cc5 100644 --- a/packages/volto/src/components/theme/View/View.jsx +++ b/packages/volto/src/components/theme/View/View.jsx @@ -261,13 +261,6 @@ class View extends Component { this.props.content.subjects.length > 0 && ( )} - {/* Add opt-in social sharing if required, disabled by default */} - {/* In the future this might be parameterized from the app config */} - {/* */} {this.props.content.allow_discussion && ( )} diff --git a/packages/volto/src/components/theme/View/View.test.jsx b/packages/volto/src/components/theme/View/View.test.jsx index 429829a067..678dbb7c51 100644 --- a/packages/volto/src/components/theme/View/View.test.jsx +++ b/packages/volto/src/components/theme/View/View.test.jsx @@ -30,9 +30,6 @@ jest.mock('../../manage/Toolbar/Toolbar', () => jest.fn(() =>
), ); -jest.mock('../SocialSharing/SocialSharing', () => - jest.fn(() =>
), -); jest.mock('../Comments/Comments', () => jest.fn(() =>
)); jest.mock('../Tags/Tags', () => jest.fn(() =>
)); jest.mock('../SlotRenderer/SlotRenderer', () => diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8d3fbd3f95..61bb21e993 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1871,9 +1871,6 @@ importers: react-select-async-paginate: specifier: 0.5.3 version: 0.5.3(react-dom@18.2.0(react@18.2.0))(react-select@4.3.1(@types/react@18.2.79)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react@18.2.0) - react-share: - specifier: 2.3.1 - version: 2.3.1(react@18.2.0) react-side-effect: specifier: 2.1.2 version: 2.1.2(react@18.2.0)