2019-07-03 09:35:15 +02:00
|
|
|
//@flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { Link } from "react-router-dom";
|
|
|
|
|
import injectSheet from "react-jss";
|
|
|
|
|
import classNames from "classnames";
|
2019-07-04 17:31:15 +02:00
|
|
|
import type { Plugin } from "@scm-manager/ui-types";
|
|
|
|
|
import PluginAvatar from "./PluginAvatar";
|
2019-07-03 09:35:15 +02:00
|
|
|
|
|
|
|
|
const styles = {
|
|
|
|
|
inner: {
|
|
|
|
|
position: "relative",
|
|
|
|
|
pointerEvents: "none",
|
|
|
|
|
zIndex: 1
|
|
|
|
|
},
|
|
|
|
|
centerImage: {
|
|
|
|
|
marginTop: "0.8em",
|
|
|
|
|
marginLeft: "1em !important"
|
2019-07-04 17:31:15 +02:00
|
|
|
},
|
|
|
|
|
marginBottom: {
|
|
|
|
|
marginBottom: "0.75rem !important"
|
2019-07-03 09:35:15 +02:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type Props = {
|
2019-07-04 17:31:15 +02:00
|
|
|
plugin: Plugin,
|
2019-07-03 09:35:15 +02:00
|
|
|
fullColumnWidth?: boolean,
|
2019-07-04 17:31:15 +02:00
|
|
|
|
2019-07-03 09:35:15 +02:00
|
|
|
// context props
|
|
|
|
|
classes: any
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PluginEntry extends React.Component<Props> {
|
|
|
|
|
render() {
|
2019-07-04 17:31:15 +02:00
|
|
|
const { plugin, classes, fullColumnWidth } = this.props;
|
2019-07-03 09:35:15 +02:00
|
|
|
const halfColumn = fullColumnWidth ? "is-full" : "is-half";
|
|
|
|
|
const overlayLinkClass = fullColumnWidth
|
|
|
|
|
? "overlay-full-column"
|
|
|
|
|
: "overlay-half-column";
|
2019-07-04 17:31:15 +02:00
|
|
|
// TODO: Add link to plugin page below
|
2019-07-03 09:35:15 +02:00
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={classNames(
|
|
|
|
|
"box",
|
|
|
|
|
"box-link-shadow",
|
|
|
|
|
"column",
|
|
|
|
|
"is-clipped",
|
|
|
|
|
halfColumn
|
|
|
|
|
)}
|
|
|
|
|
>
|
2019-07-04 17:31:15 +02:00
|
|
|
<Link
|
|
|
|
|
className={classNames(overlayLinkClass, "is-plugin-page")}
|
|
|
|
|
to="#"
|
|
|
|
|
/>
|
2019-07-03 09:35:15 +02:00
|
|
|
<article className={classNames("media", classes.inner)}>
|
|
|
|
|
<figure className={classNames(classes.centerImage, "media-left")}>
|
2019-07-04 17:31:15 +02:00
|
|
|
<PluginAvatar plugin={plugin} />
|
2019-07-03 09:35:15 +02:00
|
|
|
</figure>
|
|
|
|
|
<div className={classNames("media-content", "text-box")}>
|
|
|
|
|
<div className="content">
|
2019-07-04 17:31:15 +02:00
|
|
|
<nav
|
|
|
|
|
className={classNames(
|
|
|
|
|
"level",
|
|
|
|
|
"is-mobile",
|
|
|
|
|
classes.marginBottom
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<div className="level-left">
|
|
|
|
|
<strong>{plugin.name}</strong>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="level-right is-hidden-mobile">
|
|
|
|
|
{plugin.version}
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
|
|
|
|
<p className="shorten-text is-marginless">{plugin.description}</p>
|
|
|
|
|
<p>
|
|
|
|
|
<small>{plugin.author}</small>
|
2019-07-03 09:35:15 +02:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default injectSheet(styles)(PluginEntry);
|