11import React , { useCallback , useMemo , useState } from 'react' ;
22import { useSelector } from 'react-redux' ;
3+ import {
4+ SegmentButton ,
5+ SegmentGroup ,
6+ } from '@metamask/design-system-react-native' ;
37
48import { strings } from '../../../../../locales/i18n' ;
59import { selectIsMetamaskNotificationsEnabled } from '../../../../selectors/notifications' ;
610import { selectSocialLeaderboardEnabled } from '../../../../selectors/featureFlagController/socialLeaderboard' ;
7- import FilterTabBar , {
8- FilterTab ,
9- } from '../../../../component-library/components-temp/FilterTabBar' ;
1011
1112import {
1213 NotificationCategoryId ,
1314 NotificationsCategoryProps ,
1415} from './NotificationsCategory.types' ;
1516import { 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 */
2331const 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