Skip to content

Commit 99058b3

Browse files
authored
Remove FollowNotificationsButton (#16311)
It's not used.
1 parent 02a0ba8 commit 99058b3

4 files changed

Lines changed: 11 additions & 89 deletions

File tree

dotcom-rendering/src/components/FollowButtons.stories.tsx renamed to dotcom-rendering/src/components/FollowTagButton.stories.tsx

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
22
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat';
3-
import { FollowNotificationsButton, FollowTagButton } from './FollowButtons';
3+
import { FollowTagButton } from './FollowTagButton';
44

55
export default {
6-
component: [FollowNotificationsButton, FollowTagButton],
7-
title: 'Components/FollowStatus',
6+
component: FollowTagButton,
7+
title: 'Components/FollowTagButton',
88
args: {
99
isFollowing: false,
1010
},
1111
};
1212

1313
export const Default = ({ isFollowing }: { isFollowing: boolean }) => {
1414
return (
15-
<>
16-
<FollowTagButton
17-
isFollowing={isFollowing}
18-
displayName={'John Doe'}
19-
onClickHandler={() => undefined}
20-
/>
21-
<FollowNotificationsButton
22-
isFollowing={isFollowing}
23-
onClickHandler={() => undefined}
24-
/>
25-
</>
15+
<FollowTagButton
16+
isFollowing={isFollowing}
17+
displayName={'John Doe'}
18+
onClickHandler={() => undefined}
19+
/>
2620
);
2721
};
2822

@@ -37,22 +31,6 @@ Default.decorators = [
3731
]),
3832
];
3933

40-
export const NotificationsButtonBothStates = () => {
41-
return (
42-
<>
43-
<FollowNotificationsButton
44-
isFollowing={false}
45-
onClickHandler={() => undefined}
46-
/>
47-
<FollowNotificationsButton
48-
isFollowing={true}
49-
onClickHandler={() => undefined}
50-
/>
51-
</>
52-
);
53-
};
54-
NotificationsButtonBothStates.decorators = [splitTheme()];
55-
5634
export const FollowContributorBothStates = () => {
5735
return (
5836
<>

dotcom-rendering/src/components/FollowButtons.test.tsx renamed to dotcom-rendering/src/components/FollowTagButton.test.tsx

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
import { render, waitFor } from '@testing-library/react';
2-
import { FollowNotificationsButton, FollowTagButton } from './FollowButtons';
3-
4-
it('should show a Notifications Off button for a single contributor when rendering for apps', () => {
5-
const { getByText } = render(
6-
<FollowNotificationsButton
7-
isFollowing={false}
8-
onClickHandler={() => undefined}
9-
/>,
10-
);
11-
expect(getByText('Notifications off')).toBeInTheDocument();
12-
});
13-
14-
it('should show a Notifications On button for a single contributor when rendering for apps', async () => {
15-
const { getByText } = render(
16-
<FollowNotificationsButton
17-
onClickHandler={() => undefined}
18-
isFollowing={true}
19-
/>,
20-
);
21-
await waitFor(() =>
22-
expect(getByText('Notifications on')).toBeInTheDocument(),
23-
);
24-
});
2+
import { FollowTagButton } from './FollowTagButton';
253

264
it('should show a follow contributor button for a single contributor when rendering for apps', () => {
275
const { getByText } = render(

dotcom-rendering/src/components/FollowButtons.tsx renamed to dotcom-rendering/src/components/FollowTagButton.tsx

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { css } from '@emotion/react';
22
import { space, textSans15 } from '@guardian/source/foundations';
3-
import {
4-
SvgCheckmark,
5-
SvgNotificationsOff,
6-
SvgNotificationsOn,
7-
SvgPlus,
8-
} from '@guardian/source/react-components';
3+
import { SvgCheckmark, SvgPlus } from '@guardian/source/react-components';
94
import type { ReactNode } from 'react';
105
import { palette } from '../palette';
116

@@ -65,12 +60,6 @@ const containerStyles = css`
6560
column-gap: 0.2em;
6661
`;
6762

68-
const notificationsTextSpan = ({
69-
isFollowing,
70-
}: Pick<ButtonProps, 'isFollowing'>) => (
71-
<span>Notifications {isFollowing ? 'on' : 'off'}</span>
72-
);
73-
7463
const tagTextSpan = ({
7564
isFollowing,
7665
displayName,
@@ -90,29 +79,6 @@ type ButtonProps = {
9079
onClickHandler: () => void;
9180
};
9281

93-
export const FollowNotificationsButton = ({
94-
isFollowing,
95-
onClickHandler,
96-
withExtraBottomMargin = false,
97-
}: ButtonProps & { withExtraBottomMargin?: boolean }) => {
98-
return (
99-
<button
100-
onClick={onClickHandler}
101-
type="button"
102-
css={[buttonStyles(withExtraBottomMargin)]}
103-
>
104-
<span css={containerStyles}>
105-
<FollowIcon
106-
isFollowing={isFollowing}
107-
iconIsFollowing={<SvgNotificationsOn size="xsmall" />}
108-
iconIsNotFollowing={<SvgNotificationsOff size="xsmall" />}
109-
/>
110-
{notificationsTextSpan({ isFollowing })}
111-
</span>
112-
</button>
113-
);
114-
};
115-
11682
export const FollowTagButton = ({
11783
isFollowing,
11884
displayName = '',

dotcom-rendering/src/components/FollowWrapper.island.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { getNotificationsClient, getTagClient } from '../lib/bridgetApi';
1111
import { useIsBridgetCompatible } from '../lib/useIsBridgetCompatible';
1212
import { useIsMyGuardianEnabled } from '../lib/useIsMyGuardianEnabled';
1313
import { palette as schemedPalette } from '../palette';
14-
import { FollowTagButton } from './FollowButtons';
14+
import { FollowTagButton } from './FollowTagButton';
1515

1616
type Props = {
1717
id: string;

0 commit comments

Comments
 (0)