el.xwx.moe/webmarker/src/componets/List.js

35 lines
834 B
JavaScript
Raw Normal View History

2022-04-22 07:13:22 -05:00
import '../styles/List.css';
2022-04-16 12:50:42 -05:00
2022-04-22 07:13:22 -05:00
const List = ({data}) => {
2022-04-16 12:50:42 -05:00
return (
<table className="table">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Title</th>
<th>Link</th>
2022-04-19 07:22:53 -05:00
<th>Tag</th>
2022-04-16 12:50:42 -05:00
</tr>
</thead>
<tbody>
{data.map((e, i) => {
2022-04-22 07:13:22 -05:00
try {
const url = new URL(e.link)
return <tr key={i}>
<td>{i + 1}</td>
<td>{e.name}</td>
<td>{e.title}</td>
<td><a href={e.link}>{url.hostname}</a></td>
<td>{e.tag}</td>
</tr>
} catch (e) {
console.log(e)
}
2022-04-16 12:50:42 -05:00
})}
</tbody>
</table>
)
}
export default List