Skip to content

Commit aa61021

Browse files
committed
refactor: remove unused index prop from multiple ArticleItem and FeedItem components
1 parent 0bc199d commit aa61021

15 files changed

Lines changed: 18 additions & 52 deletions

File tree

src/features/cards/components/conferencesCard/ConferenceItem.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Attributes } from 'src/lib/analytics'
77
import { useUserPreferences } from 'src/stores/preferences'
88
import { BaseItemPropsType, Conference } from 'src/types'
99

10-
const ConferencesItem = ({ item, index, analyticsTag }: BaseItemPropsType<Conference>) => {
10+
const ConferencesItem = ({ item, analyticsTag }: BaseItemPropsType<Conference>) => {
1111
const { listingMode } = useUserPreferences()
1212

1313
const conferenceLocation = useMemo(() => {
@@ -70,8 +70,6 @@ const ConferencesItem = ({ item, index, analyticsTag }: BaseItemPropsType<Confer
7070
return (
7171
<CardItemWithActions
7272
source={analyticsTag}
73-
index={index}
74-
key={index}
7573
item={item}
7674
cardItem={
7775
<>

src/features/cards/components/devtoCard/ArticleItem.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ import { Article, BaseItemPropsType } from 'src/types'
88
import { format } from 'timeago.js'
99

1010
const ArticleItem = (props: BaseItemPropsType<Article>) => {
11-
const { item, index, selectedTag, analyticsTag } = props
11+
const { item, analyticsTag } = props
1212
const { listingMode } = useUserPreferences()
1313

1414
return (
1515
<CardItemWithActions
1616
source={analyticsTag}
17-
index={index}
18-
key={index}
1917
item={item}
2018
cardItem={
2119
<>
@@ -27,7 +25,6 @@ const ArticleItem = (props: BaseItemPropsType<Article>) => {
2725
[Attributes.TITLE]: item.title,
2826
[Attributes.LINK]: item.url,
2927
[Attributes.SOURCE]: analyticsTag,
30-
[Attributes.LANGUAGE]: selectedTag?.value,
3128
}}>
3229
{listingMode === 'compact' && (
3330
<div className="counterWrapper">

src/features/cards/components/freecodecampCard/ArticleItem.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
import { CardLink, CardItemWithActions } from 'src/components/Elements'
1+
import { MdAccessTime } from 'react-icons/md'
2+
import { CardItemWithActions, CardLink, ColoredLanguagesBadge } from 'src/components/Elements'
23
import { Attributes } from 'src/lib/analytics'
3-
import { BaseItemPropsType, Article } from 'src/types'
4+
import { Article, BaseItemPropsType } from 'src/types'
45
import { format } from 'timeago.js'
5-
import { MdAccessTime } from 'react-icons/md'
6-
import { ColoredLanguagesBadge } from 'src/components/Elements'
76

87
const ArticleItem = (props: BaseItemPropsType<Article>) => {
9-
const { item, index, selectedTag, analyticsTag } = props
8+
const { item, selectedTag, analyticsTag } = props
109
return (
1110
<CardItemWithActions
1211
source={analyticsTag}
13-
index={index}
14-
key={index}
1512
item={item}
1613
cardItem={
1714
<>

src/features/cards/components/githubCard/RepoItem.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ function numberWithCommas(x: number | string) {
1010
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
1111
}
1212

13-
const RepoItem = ({ item, index, selectedTag, analyticsTag }: BaseItemPropsType<Repository>) => {
13+
const RepoItem = ({ item, selectedTag, analyticsTag }: BaseItemPropsType<Repository>) => {
1414
const { listingMode } = useUserPreferences()
1515

1616
return (
1717
<CardItemWithActions
1818
source={analyticsTag}
19-
key={index}
20-
index={index}
2119
item={item}
2220
cardItem={
2321
<>

src/features/cards/components/hackernewsCard/ArticleItem.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ import { Article, BaseItemPropsType } from 'src/types'
99
import { format } from 'timeago.js'
1010

1111
const ArticleItem = (props: BaseItemPropsType<Article>) => {
12-
const { item, index, analyticsTag } = props
12+
const { item, analyticsTag } = props
1313
const { listingMode } = useUserPreferences()
1414

1515
return (
1616
<CardItemWithActions
1717
source={analyticsTag}
18-
index={index}
1918
item={item}
20-
key={index}
2119
cardItem={
2220
<>
2321
<p className="rowTitle">

src/features/cards/components/hashnodeCard/ArticleItem.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ import { AiTwotoneHeart } from 'react-icons/ai'
1111
import { Attributes } from 'src/lib/analytics'
1212

1313
const ArticleItem = (props: BaseItemPropsType<Article>) => {
14-
const { item, index, selectedTag, analyticsTag } = props
14+
const { item, selectedTag, analyticsTag } = props
1515
const { listingMode } = useUserPreferences()
1616

1717
return (
1818
<CardItemWithActions
1919
source={analyticsTag}
20-
index={index}
21-
key={index}
2220
item={item}
2321
cardItem={
2422
<>

src/features/cards/components/indiehackersCard/ArticleItem.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ import { Article, BaseItemPropsType } from 'src/types'
99
import { format } from 'timeago.js'
1010

1111
export const ArticleItem = (props: BaseItemPropsType<Article>) => {
12-
const { item, index, analyticsTag } = props
12+
const { item, analyticsTag } = props
1313
const { listingMode } = useUserPreferences()
1414

1515
return (
1616
<CardItemWithActions
1717
source={analyticsTag}
18-
index={index}
1918
item={item}
2019
key={item.id}
2120
cardItem={

src/features/cards/components/lobstersCard/ArticleItem.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ import { useUserPreferences } from 'src/stores/preferences'
88
import { Article, BaseItemPropsType } from 'src/types'
99
import { format } from 'timeago.js'
1010

11-
const ArticleItem = ({ item, index, analyticsTag }: BaseItemPropsType<Article>) => {
11+
const ArticleItem = ({ item, analyticsTag }: BaseItemPropsType<Article>) => {
1212
const { listingMode } = useUserPreferences()
1313

1414
return (
1515
<CardItemWithActions
1616
source={analyticsTag}
17-
index={index}
1817
item={item}
19-
key={index}
2018
cardItem={
2119
<>
2220
<p className="rowTitle">

src/features/cards/components/mediumCard/ArticleItem.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ import { useUserPreferences } from 'src/stores/preferences'
66
import { Article, BaseItemPropsType } from 'src/types'
77
import { format } from 'timeago.js'
88

9-
const ArticleItem = ({ item, index, selectedTag, analyticsTag }: BaseItemPropsType<Article>) => {
9+
const ArticleItem = ({ item, selectedTag, analyticsTag }: BaseItemPropsType<Article>) => {
1010
const { listingMode } = useUserPreferences()
1111

1212
return (
1313
<CardItemWithActions
1414
source={analyticsTag}
15-
index={index}
1615
key={index}
1716
item={item}
1817
cardItem={

src/features/cards/components/redditCard/ArticleItem.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const PostFlair = ({ text, bgColor, textColor }: PostFlairPropsType) => {
2626
)
2727
}
2828

29-
const ArticleItem = ({ item, index, analyticsTag }: BaseItemPropsType<Article>) => {
29+
const ArticleItem = ({ item, analyticsTag }: BaseItemPropsType<Article>) => {
3030
const { listingMode } = useUserPreferences()
3131

3232
const subReddit = useMemo(() => {
@@ -41,8 +41,6 @@ const ArticleItem = ({ item, index, analyticsTag }: BaseItemPropsType<Article>)
4141
return (
4242
<CardItemWithActions
4343
source={analyticsTag}
44-
index={index}
45-
key={index}
4644
item={item}
4745
cardItem={
4846
<>

0 commit comments

Comments
 (0)