Skip to content

Commit 91c5f0c

Browse files
committed
chore: simplify implementation
1 parent 201c56d commit 91c5f0c

4 files changed

Lines changed: 28 additions & 112 deletions

File tree

app/component-library/components-temp/FilterTabBar/FilterTabBar.tsx

Lines changed: 0 additions & 50 deletions
This file was deleted.

app/component-library/components-temp/FilterTabBar/FilterTabBar.types.ts

Lines changed: 0 additions & 46 deletions
This file was deleted.

app/component-library/components-temp/FilterTabBar/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

app/components/Views/Notifications/NotificationsCategory/NotificationsCategory.tsx

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
import React, { useCallback, useMemo, useState } from 'react';
22
import { useSelector } from 'react-redux';
3+
import {
4+
SegmentButton,
5+
SegmentGroup,
6+
} from '@metamask/design-system-react-native';
37

48
import { strings } from '../../../../../locales/i18n';
59
import { selectIsMetamaskNotificationsEnabled } from '../../../../selectors/notifications';
610
import { selectSocialLeaderboardEnabled } from '../../../../selectors/featureFlagController/socialLeaderboard';
7-
import FilterTabBar, {
8-
FilterTab,
9-
} from '../../../../component-library/components-temp/FilterTabBar';
1011

1112
import {
1213
NotificationCategoryId,
1314
NotificationsCategoryProps,
1415
} from './NotificationsCategory.types';
1516
import { NotificationsCategorySelectorsIDs } from './NotificationsCategory.testIds';
1617

18+
interface CategoryTab {
19+
key: NotificationCategoryId;
20+
label: string;
21+
testID: string;
22+
}
23+
1724
/**
18-
* Horizontally scrollable category filter for the notifications list. The set
19-
* of categories is gated by feature flags: the activity-related categories only
20-
* appear when MetaMask notifications are enabled, and "Trading Signals" only
21-
* when the social leaderboard flag is on.
25+
* Horizontally scrollable category filter for the notifications list, built on
26+
* the design-system `SegmentGroup` / `SegmentButton`. The set of categories is
27+
* gated by feature flags: the activity-related categories only appear when
28+
* MetaMask notifications are enabled, and "Trading Signals" only when the social
29+
* leaderboard flag is on.
2230
*/
2331
const NotificationsCategory = ({
2432
onSelect,
@@ -34,8 +42,8 @@ const NotificationsCategory = ({
3442
const [selectedCategory, setSelectedCategory] =
3543
useState<NotificationCategoryId>(NotificationCategoryId.All);
3644

37-
const tabs = useMemo<FilterTab[]>(() => {
38-
const items: FilterTab[] = [
45+
const tabs = useMemo<CategoryTab[]>(() => {
46+
const items: CategoryTab[] = [
3947
{
4048
key: NotificationCategoryId.All,
4149
label: strings('app_settings.notifications_opts.all_title'),
@@ -87,12 +95,18 @@ const NotificationsCategory = ({
8795
);
8896

8997
return (
90-
<FilterTabBar
91-
tabs={tabs}
92-
selectedKey={selectedCategory}
93-
onSelect={handleSelect}
98+
<SegmentGroup
99+
value={selectedCategory}
100+
onChange={handleSelect}
101+
twClassName="gap-2 px-4 py-1"
94102
testID={testID ?? NotificationsCategorySelectorsIDs.CONTAINER}
95-
/>
103+
>
104+
{tabs.map((tab) => (
105+
<SegmentButton key={tab.key} value={tab.key} testID={tab.testID}>
106+
{tab.label}
107+
</SegmentButton>
108+
))}
109+
</SegmentGroup>
96110
);
97111
};
98112

0 commit comments

Comments
 (0)