mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-14 10:36:20 +00:00
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { FC } from 'react';
|
|
import { ListGroup, ListGroupItem } from 'reactstrap';
|
|
import { Link } from 'react-router-dom';
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
import { faChevronRight as chevronIcon } from '@fortawesome/free-solid-svg-icons';
|
|
import { ServerWithId } from './data';
|
|
import './ServersListGroup.scss';
|
|
|
|
interface ServersListGroup {
|
|
servers: ServerWithId[];
|
|
}
|
|
|
|
const ServerListItem = ({ id, name }: { id: string; name: string }) => (
|
|
<ListGroupItem tag={Link} to={`/server/${id}/list-short-urls/1`} className="servers-list__server-item">
|
|
{name}
|
|
<FontAwesomeIcon icon={chevronIcon} className="servers-list__server-item-icon" />
|
|
</ListGroupItem>
|
|
);
|
|
|
|
const ServersListGroup: FC<ServersListGroup> = ({ servers, children }) => (
|
|
<>
|
|
<div className="container">
|
|
<h5>{children}</h5>
|
|
</div>
|
|
{servers.length > 0 && (
|
|
<ListGroup className="servers-list__list-group mt-md-3">
|
|
{servers.map(({ id, name }) => <ServerListItem key={id} id={id} name={name} />)}
|
|
</ListGroup>
|
|
)}
|
|
</>
|
|
);
|
|
|
|
export default ServersListGroup;
|