From 9ef3a05f04ed516993936e0b613ecfd518ddb321 Mon Sep 17 00:00:00 2001
From: Stefano Pigozzi <256895@studenti.unimore.it>
Date: Tue, 11 May 2021 18:34:07 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Improve=20Summary=20styling?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
code/frontend/src/components/base/Summary.js | 3 +-
.../src/components/base/Summary.module.css | 7 +-
.../interactive/SummaryRepository.js | 103 +++++++-----------
3 files changed, 50 insertions(+), 63 deletions(-)
diff --git a/code/frontend/src/components/base/Summary.js b/code/frontend/src/components/base/Summary.js
index 0be0bd9..03445a3 100644
--- a/code/frontend/src/components/base/Summary.js
+++ b/code/frontend/src/components/base/Summary.js
@@ -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.
*
+ * @param icon - The icon of the summary.
* @param title - The title of the summary.
* @param subtitle - The subtitle of the summary.
* @param upperLabel - The label for the upper value.
@@ -20,7 +21,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
* @constructor
*/
export default function Summary(
- { title, subtitle, upperLabel, upperValue, lowerLabel, lowerValue, buttons, className, ...props },
+ { icon, title, subtitle, upperLabel, upperValue, lowerLabel, lowerValue, buttons, className, ...props },
) {
return (
diff --git a/code/frontend/src/components/base/Summary.module.css b/code/frontend/src/components/base/Summary.module.css
index 65cf91f..25eb708 100644
--- a/code/frontend/src/components/base/Summary.module.css
+++ b/code/frontend/src/components/base/Summary.module.css
@@ -45,7 +45,6 @@
.Title {
grid-area: c;
- font-size: large;
align-self: flex-end;
}
@@ -65,11 +64,17 @@
display: grid;
grid-template-columns: auto 1fr;
grid-template-rows: 1fr 1fr;
+ grid-column-gap: 10px;
+ align-items: center;
+
+ font-size: small;
}
.Middle .Label {
grid-column: 1;
+ text-align: right;
+ font-weight: bold;
}
.Middle .Value {
diff --git a/code/frontend/src/components/interactive/SummaryRepository.js b/code/frontend/src/components/interactive/SummaryRepository.js
index 2dffa4b..aa39343 100644
--- a/code/frontend/src/components/interactive/SummaryRepository.js
+++ b/code/frontend/src/components/interactive/SummaryRepository.js
@@ -1,12 +1,10 @@
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 { faArchive, faFolder, faFolderOpen, faPencilAlt, faTrash } from "@fortawesome/free-solid-svg-icons"
import { useHistory } from "react-router"
import useBackend from "../../hooks/useBackend"
import ContextUser from "../../contexts/ContextUser"
+import Summary from "../base/Summary"
/**
@@ -50,64 +48,47 @@ export default function SummaryRepository(
await refresh()
}
+ const buttons = <>
+ {canDelete ?
+
+ : null}
+ {canEdit ?
+
+ : null}
+ {canArchive ?
+
+ : null}
+ >
+
return (
-
-
-
-
-
-
- {repo.name}
-
-
- {repo.owner.username}
-
-
-
-
- Start:
-
-
- {repo.start}
-
-
- End:
-
-
- {repo.end}
-
-
-
- {canDelete ?
-
- : null}
- {canEdit ?
-
- : null}
- {canArchive ?
-
- : null}
-
-
+
)
}