Files
fredy/ui/src/components/table/ProviderTable.jsx

48 lines
1.5 KiB
React
Raw Normal View History

2025-12-11 10:40:55 +01:00
/*
* Copyright (c) 2026 by Christian Kellner.
2025-12-11 10:40:55 +01:00
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
*/
import { Empty, Table, Button } from '@douyinfe/semi-ui-19';
import { IconDelete, IconEdit } from '@douyinfe/semi-icons';
import { Typography } from '@douyinfe/semi-ui';
2026-06-04 10:35:42 +02:00
import { useTranslation } from '../../services/i18n/i18n.jsx';
export default function ProviderTable({ providerData = [], onRemove, onEdit } = {}) {
2026-06-04 10:35:42 +02:00
const t = useTranslation();
const { Text } = Typography;
return (
2023-03-20 08:52:13 +01:00
<Table
pagination={false}
2026-06-04 10:35:42 +02:00
empty={<Empty description={t('provider.tableEmptyState')} />}
2023-03-20 08:52:13 +01:00
columns={[
{
2026-06-04 10:35:42 +02:00
title: t('provider.tableColumnName'),
2023-03-20 08:52:13 +01:00
dataIndex: 'name',
},
{
2026-06-04 10:35:42 +02:00
title: t('provider.tableColumnUrl'),
2023-03-20 08:52:13 +01:00
dataIndex: 'url',
render: (_, data) => {
2026-06-04 10:35:42 +02:00
return <Text link={{ href: data.url, target: '_blank' }}>{t('provider.tableOpenProvider')}</Text>;
2023-03-20 08:52:13 +01:00
},
},
{
title: '',
dataIndex: 'tools',
render: (_, record) => {
return (
<div style={{ float: 'right' }}>
<Button type="secondary" icon={<IconEdit />} onClick={() => onEdit(record)} />
<div style={{ display: 'inline-block', width: '16px' }} />
<Button type="danger" icon={<IconDelete />} onClick={() => onRemove(record.url)} />
</div>
2023-03-20 08:52:13 +01:00
);
},
},
]}
dataSource={providerData}
/>
);
}