diff --git a/scm-core/src/main/java/sonia/scm/web/VndMediaType.java b/scm-core/src/main/java/sonia/scm/web/VndMediaType.java index c9696b0641..24250b26ba 100644 --- a/scm-core/src/main/java/sonia/scm/web/VndMediaType.java +++ b/scm-core/src/main/java/sonia/scm/web/VndMediaType.java @@ -37,6 +37,8 @@ public class VndMediaType { public static final String REPOSITORY_VERB_COLLECTION = PREFIX + "repositoryVerbCollection" + SUFFIX; public static final String REPOSITORY_TYPE_COLLECTION = PREFIX + "repositoryTypeCollection" + SUFFIX; public static final String REPOSITORY_TYPE = PREFIX + "repositoryType" + SUFFIX; + public static final String PLUGIN = PREFIX + "plugin" + SUFFIX; + public static final String PLUGIN_COLLECTION = PREFIX + "pluginCollection" + SUFFIX; public static final String UI_PLUGIN = PREFIX + "uiPlugin" + SUFFIX; public static final String UI_PLUGIN_COLLECTION = PREFIX + "uiPluginCollection" + SUFFIX; @SuppressWarnings("squid:S2068") diff --git a/scm-ui-components/packages/ui-components/src/CardColumn.js b/scm-ui-components/packages/ui-components/src/CardColumn.js new file mode 100644 index 0000000000..e1eb65255a --- /dev/null +++ b/scm-ui-components/packages/ui-components/src/CardColumn.js @@ -0,0 +1,87 @@ +//@flow +import * as React from "react"; +import injectSheet from "react-jss"; +import classNames from "classnames"; + +import { Link } from "react-router-dom"; + +const styles = { + inner: { + position: "relative", + pointerEvents: "none", + zIndex: 1 + }, + innerLink: { + pointerEvents: "all" + }, + centerImage: { + marginTop: "0.8em", + marginLeft: "1em !important" + }, + flexFullHeight: { + display: "flex", + flexDirection: "column", + alignSelf: "stretch" + }, + content: { + display: "flex", + flexGrow: 1 + }, + footer: { + display: "flex", + marginTop: "auto", + paddingBottom: "1.5rem" + } +}; + +type Props = { + title: string, + description: string, + avatar: React.Node, + footerLeft: React.Node, + footerRight: React.Node, + link: string, + // context props + classes: any +}; + +class CardColumn extends React.Component { + createLink = () => { + const { link } = this.props; + if (link) { + return ; + } + return null; + }; + + render() { + const { avatar, title, description, footerLeft, footerRight, classes } = this.props; + const link = this.createLink(); + return ( + <> + {link} +
+
+ {avatar} +
+
+
+
+

+ {title} +

+

{description}

+
+
+
+
{footerLeft}
+
{footerRight}
+
+
+
+ + ); + } +} + +export default injectSheet(styles)(CardColumn); diff --git a/scm-ui-components/packages/ui-components/src/CardColumnGroup.js b/scm-ui-components/packages/ui-components/src/CardColumnGroup.js new file mode 100644 index 0000000000..b72bd97dd7 --- /dev/null +++ b/scm-ui-components/packages/ui-components/src/CardColumnGroup.js @@ -0,0 +1,103 @@ +//@flow +import * as React from "react"; +import injectSheet from "react-jss"; +import classNames from "classnames"; + +const styles = { + pointer: { + cursor: "pointer", + fontSize: "1.5rem" + }, + repoGroup: { + marginBottom: "1em" + }, + wrapper: { + padding: "0 0.75rem" + }, + clearfix: { + clear: "both" + } +}; + +type Props = { + name: string, + elements: React.Node[], + + // context props + classes: any +}; + +type State = { + collapsed: boolean +}; + +class CardColumnGroup extends React.Component { + constructor(props: Props) { + super(props); + this.state = { + collapsed: false + }; + } + + toggleCollapse = () => { + this.setState(prevState => ({ + collapsed: !prevState.collapsed + })); + }; + + isLastEntry = (array: React.Node[], index: number) => { + return index === array.length - 1; + }; + + isLengthOdd = (array: React.Node[]) => { + return array.length % 2 !== 0; + }; + + isFullSize = (array: React.Node[], index: number) => { + return this.isLastEntry(array, index) && this.isLengthOdd(array); + }; + + render() { + const { name, elements, classes } = this.props; + const { collapsed } = this.state; + + const icon = collapsed ? "fa-angle-right" : "fa-angle-down"; + let content = null; + if (!collapsed) { + content = elements.map((entry, index) => { + const fullColumnWidth = this.isFullSize(elements, index); + const sizeClass = fullColumnWidth ? "is-full" : "is-half"; + return ( +
+ {entry} +
+ ); + }); + } + return ( +
+

+ + {name} + +

+
+
+ {content} +
+
+
+ ); + } +} + +export default injectSheet(styles)(CardColumnGroup); diff --git a/scm-ui-components/packages/ui-components/src/LinkPaginator.js b/scm-ui-components/packages/ui-components/src/LinkPaginator.js index a662272b11..a5d67816d0 100644 --- a/scm-ui-components/packages/ui-components/src/LinkPaginator.js +++ b/scm-ui-components/packages/ui-components/src/LinkPaginator.js @@ -25,7 +25,7 @@ class LinkPaginator extends React.Component { renderFirstButton() { return (