fix: list tags key warning (#1056)

This commit is contained in:
Aman Harwara
2022-05-31 17:59:50 +05:30
committed by GitHub
parent cab27656ba
commit ef7166c3d2
3 changed files with 10 additions and 5 deletions

View File

@@ -22,7 +22,7 @@ const ContentListItem: FunctionComponent<AbstractListItemProps> = (props) => {
return []
}
return tags.map((tag) => tag.title).sort()
return tags
}
switch (props.item.content_type) {

View File

@@ -1,9 +1,10 @@
import { FunctionComponent } from 'react'
import Icon from '@/Components/Icon/Icon'
import { DisplayableListItemProps } from './Types/DisplayableListItemProps'
type Props = {
hideTags: boolean
tags: string[]
tags: DisplayableListItemProps['tags']
}
const ListItemTags: FunctionComponent<Props> = ({ hideTags, tags }) => {
@@ -16,10 +17,10 @@ const ListItemTags: FunctionComponent<Props> = ({ hideTags, tags }) => {
{tags.map((tag) => (
<span
className="inline-flex items-center py-1 px-1.5 bg-passive-4-opacity-variant color-foreground rounded-0.5"
key={tag}
key={tag.uuid}
>
<Icon type="hashtag" className="sn-icon--small color-passive-1 mr-1" />
<span>{tag}</span>
<span>{tag.title}</span>
</span>
))}
</div>

View File

@@ -1,5 +1,9 @@
import { SNTag } from '@standardnotes/snjs'
import { AbstractListItemProps } from './AbstractListItemProps'
export type DisplayableListItemProps = AbstractListItemProps & {
tags: string[]
tags: {
uuid: SNTag['uuid']
title: SNTag['title']
}[]
}