Extracted short URLs table into reusable component to use both on list section and overview section

This commit is contained in:
Alejandro Celaya
2020-12-07 11:17:19 +01:00
parent dba0ac6442
commit 032e9c53f3
12 changed files with 276 additions and 206 deletions

View File

@@ -16,8 +16,8 @@ import { ShortUrlsRowMenuProps } from './ShortUrlsRowMenu';
import './ShortUrlsRow.scss';
export interface ShortUrlsRowProps {
refreshList: Function;
shortUrlsListParams: ShortUrlsListParams;
refreshList?: Function;
shortUrlsListParams?: ShortUrlsListParams;
selectedServer: SelectedServer;
shortUrl: ShortUrl;
}
@@ -36,14 +36,14 @@ const ShortUrlsRow = (
return <i className="indivisible"><small>No tags</small></i>;
}
const selectedTags = shortUrlsListParams.tags ?? [];
const selectedTags = shortUrlsListParams?.tags ?? [];
return tags.map((tag) => (
<Tag
colorGenerator={colorGenerator}
key={tag}
text={tag}
onClick={() => refreshList({ tags: [ ...selectedTags, tag ] })}
onClick={() => refreshList?.({ tags: [ ...selectedTags, tag ] })}
/>
));
};