mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 14:34:19 +00:00
🔧 Improve Summary styling
This commit is contained in:
parent
d8ac277f47
commit
9ef3a05f04
3 changed files with 50 additions and 63 deletions
|
@ -7,6 +7,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||||
/**
|
/**
|
||||||
* A long line displaying the summary of a certain entity, such as a repository or an user.
|
* A long line displaying the summary of a certain entity, such as a repository or an user.
|
||||||
*
|
*
|
||||||
|
* @param icon - The icon of the summary.
|
||||||
* @param title - The title of the summary.
|
* @param title - The title of the summary.
|
||||||
* @param subtitle - The subtitle of the summary.
|
* @param subtitle - The subtitle of the summary.
|
||||||
* @param upperLabel - The label for the upper value.
|
* @param upperLabel - The label for the upper value.
|
||||||
|
@ -20,7 +21,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function Summary(
|
export default function Summary(
|
||||||
{ title, subtitle, upperLabel, upperValue, lowerLabel, lowerValue, buttons, className, ...props },
|
{ icon, title, subtitle, upperLabel, upperValue, lowerLabel, lowerValue, buttons, className, ...props },
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<div className={classNames(Style.Summary, className)} {...props}>
|
<div className={classNames(Style.Summary, className)} {...props}>
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
|
|
||||||
.Title {
|
.Title {
|
||||||
grid-area: c;
|
grid-area: c;
|
||||||
font-size: large;
|
|
||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +64,17 @@
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto 1fr;
|
grid-template-columns: auto 1fr;
|
||||||
grid-template-rows: 1fr 1fr;
|
grid-template-rows: 1fr 1fr;
|
||||||
|
grid-column-gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
font-size: small;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.Middle .Label {
|
.Middle .Label {
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
|
text-align: right;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Middle .Value {
|
.Middle .Value {
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import React, { useContext } from "react"
|
import React, { useContext } from "react"
|
||||||
import Style from "./RepositorySummaryBase.module.css"
|
|
||||||
import classNames from "classnames"
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
|
||||||
import Button from "../base/Button"
|
import Button from "../base/Button"
|
||||||
import { faArchive, faFolder, faFolderOpen, faPencilAlt, faTrash } from "@fortawesome/free-solid-svg-icons"
|
import { faArchive, faFolder, faFolderOpen, faPencilAlt, faTrash } from "@fortawesome/free-solid-svg-icons"
|
||||||
import { useHistory } from "react-router"
|
import { useHistory } from "react-router"
|
||||||
import useBackend from "../../hooks/useBackend"
|
import useBackend from "../../hooks/useBackend"
|
||||||
import ContextUser from "../../contexts/ContextUser"
|
import ContextUser from "../../contexts/ContextUser"
|
||||||
|
import Summary from "../base/Summary"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,36 +48,7 @@ export default function SummaryRepository(
|
||||||
await refresh()
|
await refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
const buttons = <>
|
||||||
<div className={classNames(Style.RepositorySummary, className)} {...props}>
|
|
||||||
<div className={Style.Left}>
|
|
||||||
<div className={Style.IconContainer}>
|
|
||||||
<FontAwesomeIcon
|
|
||||||
icon={repo.is_active ? faFolderOpen : faFolder}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className={Style.Title}>
|
|
||||||
{repo.name}
|
|
||||||
</div>
|
|
||||||
<div className={Style.Author}>
|
|
||||||
{repo.owner.username}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className={Style.Middle}>
|
|
||||||
<div className={classNames(Style.MiddleLabel, Style.MiddleTop)}>
|
|
||||||
Start:
|
|
||||||
</div>
|
|
||||||
<div className={classNames(Style.MiddleValue, Style.MiddleTop)}>
|
|
||||||
{repo.start}
|
|
||||||
</div>
|
|
||||||
<div className={classNames(Style.MiddleLabel, Style.MiddleBot)}>
|
|
||||||
End:
|
|
||||||
</div>
|
|
||||||
<div className={classNames(Style.MiddleValue, Style.MiddleBot)}>
|
|
||||||
{repo.end}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className={Style.Right}>
|
|
||||||
{canDelete ?
|
{canDelete ?
|
||||||
<Button
|
<Button
|
||||||
color={"Red"}
|
color={"Red"}
|
||||||
|
@ -107,7 +76,19 @@ export default function SummaryRepository(
|
||||||
{repo.is_active ? "Archive" : "Unarchive"}
|
{repo.is_active ? "Archive" : "Unarchive"}
|
||||||
</Button>
|
</Button>
|
||||||
: null}
|
: null}
|
||||||
</div>
|
</>
|
||||||
</div>
|
|
||||||
|
return (
|
||||||
|
<Summary
|
||||||
|
icon={repo.is_active ? faFolderOpen : faFolder}
|
||||||
|
title={repo.name}
|
||||||
|
subtitle={repo.author}
|
||||||
|
upperLabel={"Start"}
|
||||||
|
upperValue={repo.start ? new Date(repo.start).toLocaleString() : null}
|
||||||
|
lowerLabel={"End"}
|
||||||
|
lowerValue={repo.end ? new Date(repo.end).toLocaleString() : null}
|
||||||
|
buttons={buttons}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue