2021-04-24 02:23:23 +00:00
|
|
|
import React from "react"
|
2021-04-26 16:37:14 +00:00
|
|
|
import Style from "./RepositorySummaryBase.module.css"
|
2021-04-24 02:23:23 +00:00
|
|
|
import classNames from "classnames"
|
|
|
|
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"
|
2021-04-29 14:58:31 +00:00
|
|
|
import Button from "../base/Button"
|
2021-04-24 02:23:23 +00:00
|
|
|
import { faArchive, faPencilAlt, faTrash } from "@fortawesome/free-solid-svg-icons"
|
|
|
|
|
|
|
|
|
2021-04-25 15:22:52 +00:00
|
|
|
/**
|
|
|
|
* A long line representing a repository in a list.
|
|
|
|
*
|
|
|
|
* @param icon - The FontAwesome IconDefinition that represents the repository.
|
2021-05-02 16:10:09 +00:00
|
|
|
* @param name - The title of the repository.
|
2021-04-25 15:22:52 +00:00
|
|
|
* @todo What goes in the details field?
|
|
|
|
* @param details - Whatever should be rendered in the details field.
|
2021-05-02 16:10:09 +00:00
|
|
|
* @param start - The start date of the repository.
|
|
|
|
* @param end - The end date of the repository.
|
|
|
|
* @param isActive - Whether the repository is active or not.
|
2021-04-25 15:22:52 +00:00
|
|
|
* @param canDelete - If the Delete button should be displayed or not.
|
|
|
|
* @param canEdit - If the Edit button should be displayed or not.
|
|
|
|
* @param canArchive - If the Archive button should be displayed or not.
|
|
|
|
* @param className - Additional class(es) to be added to the outer box.
|
|
|
|
* @param props - Additional props to pass to the outer box.
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
export default function RepositorySummaryBase(
|
2021-05-02 16:10:09 +00:00
|
|
|
{ icon, name, details, start, end, isActive, canDelete, canEdit, canArchive, className, ...props }
|
2021-04-25 15:22:52 +00:00
|
|
|
) {
|
2021-04-24 02:23:23 +00:00
|
|
|
return (
|
|
|
|
<div className={classNames(Style.RepositorySummary, className)} {...props}>
|
|
|
|
<div className={Style.Left}>
|
|
|
|
<div className={Style.IconContainer}>
|
|
|
|
<FontAwesomeIcon icon={icon}/>
|
|
|
|
</div>
|
|
|
|
<div className={Style.Title}>
|
2021-05-02 16:10:09 +00:00
|
|
|
{name}
|
2021-04-24 02:23:23 +00:00
|
|
|
</div>
|
|
|
|
<div className={Style.StartDate}>
|
2021-05-02 16:10:09 +00:00
|
|
|
{start}
|
2021-04-24 02:23:23 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={Style.Middle}>
|
|
|
|
{details}
|
|
|
|
</div>
|
|
|
|
<div className={Style.Right}>
|
|
|
|
{canDelete ?
|
|
|
|
<Button color={"Red"} icon={faTrash}>Delete</Button>
|
|
|
|
: null}
|
|
|
|
{canEdit ?
|
|
|
|
<Button color={"Yellow"} icon={faPencilAlt}>Edit</Button>
|
|
|
|
: null}
|
|
|
|
{canArchive ?
|
2021-05-02 16:10:09 +00:00
|
|
|
<Button color={"Grey"} icon={faArchive}>{isActive ? "Archive" : "Unarchive"}</Button>
|
2021-04-24 02:23:23 +00:00
|
|
|
: null}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|