From 0e924a3176c2c46dc7a2fca958aeb9518b87ac94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Thu, 20 Dec 2018 09:48:01 +0100 Subject: [PATCH] shorten description if it is longer than expected --- .../repos/components/list/RepositoryEntry.js | 226 +++++++++--------- scm-ui/styles/scm.scss | 13 + 2 files changed, 131 insertions(+), 108 deletions(-) diff --git a/scm-ui/src/repos/components/list/RepositoryEntry.js b/scm-ui/src/repos/components/list/RepositoryEntry.js index 571e53488e..964c3f29fa 100644 --- a/scm-ui/src/repos/components/list/RepositoryEntry.js +++ b/scm-ui/src/repos/components/list/RepositoryEntry.js @@ -1,108 +1,118 @@ -//@flow -import React from "react"; -import { Link } from "react-router-dom"; -import injectSheet from "react-jss"; -import type { Repository } from "@scm-manager/ui-types"; -import { DateFromNow } from "@scm-manager/ui-components"; -import RepositoryEntryLink from "./RepositoryEntryLink"; -import classNames from "classnames"; -import RepositoryAvatar from "./RepositoryAvatar"; - -const styles = { - overlay: { - position: "absolute", - height: "calc(120px - 1.5rem)", - width: "calc(50% - 3rem)" - }, - inner: { - position: "relative", - pointerEvents: "none", - zIndex: 1 - }, - innerLink: { - pointerEvents: "all" - } -}; - -type Props = { - repository: Repository, - // context props - classes: any -}; - -class RepositoryEntry extends React.Component { - createLink = (repository: Repository) => { - return `/repo/${repository.namespace}/${repository.name}`; - }; - - renderChangesetsLink = (repository: Repository, repositoryLink: string) => { - if (repository._links["changesets"]) { - return ( - - ); - } - return null; - }; - - renderSourcesLink = (repository: Repository, repositoryLink: string) => { - if (repository._links["sources"]) { - return ( - - ); - } - return null; - }; - - renderModifyLink = (repository: Repository, repositoryLink: string) => { - if (repository._links["update"]) { - return ( - - ); - } - return null; - }; - - render() { - const { repository, classes } = this.props; - const repositoryLink = this.createLink(repository); - return ( -
- -
-
- -
-
-
-

- {repository.name} -
- {repository.description} -

-
- -
-
-
- ); - } -} - -export default injectSheet(styles)(RepositoryEntry); +//@flow +import React from "react"; +import { Link } from "react-router-dom"; +import injectSheet from "react-jss"; +import type { Repository } from "@scm-manager/ui-types"; +import { DateFromNow } from "@scm-manager/ui-components"; +import RepositoryEntryLink from "./RepositoryEntryLink"; +import classNames from "classnames"; +import RepositoryAvatar from "./RepositoryAvatar"; + +const styles = { + overlay: { + position: "absolute", + height: "calc(120px - 1.5rem)", + width: "calc(50% - 3rem)" + }, + inner: { + position: "relative", + pointerEvents: "none", + zIndex: 1 + }, + innerLink: { + pointerEvents: "all" + } +}; + +type Props = { + repository: Repository, + // context props + classes: any +}; + +class RepositoryEntry extends React.Component { + createLink = (repository: Repository) => { + return `/repo/${repository.namespace}/${repository.name}`; + }; + + renderChangesetsLink = (repository: Repository, repositoryLink: string) => { + if (repository._links["changesets"]) { + return ( + + ); + } + return null; + }; + + renderSourcesLink = (repository: Repository, repositoryLink: string) => { + if (repository._links["sources"]) { + return ( + + ); + } + return null; + }; + + renderModifyLink = (repository: Repository, repositoryLink: string) => { + if (repository._links["update"]) { + return ( + + ); + } + return null; + }; + + render() { + const { repository, classes } = this.props; + const repositoryLink = this.createLink(repository); + + return ( +
+ +
+
+ +
+
+
+

+ {repository.name} +

+

{repository.description}

+
+ +
+
+
+ ); + } +} + +export default injectSheet(styles)(RepositoryEntry); diff --git a/scm-ui/styles/scm.scss b/scm-ui/styles/scm.scss index 0f2a3986ae..ecb7f3dc64 100644 --- a/scm-ui/styles/scm.scss +++ b/scm-ui/styles/scm.scss @@ -117,6 +117,19 @@ $fa-font-path: "webfonts"; } } + +.media { + .media-content{ + width: calc(50% - .75rem); + max-height: 120px; + .shorten-text{ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } +} + // tables .table { width: 100%;