diff --git a/scm-plugins/scm-hg-plugin/src/main/js/HgConfigurationForm.js b/scm-plugins/scm-hg-plugin/src/main/js/HgConfigurationForm.js index b0935b238e..2049850e8e 100644 --- a/scm-plugins/scm-hg-plugin/src/main/js/HgConfigurationForm.js +++ b/scm-plugins/scm-hg-plugin/src/main/js/HgConfigurationForm.js @@ -5,15 +5,15 @@ import { translate } from "react-i18next"; import { InputField, Checkbox } from "@scm-manager/ui-components"; type Configuration = { - "hgBinary": string, - "pythonBinary": string, - "pythonPath"?: string, - "encoding": string, - "useOptimizedBytecode": boolean, - "showRevisionInId": boolean, - "disableHookSSLValidation": boolean, - "enableHttpPostArgs": boolean, - "_links": Links + hgBinary: string, + pythonBinary: string, + pythonPath?: string, + encoding: string, + useOptimizedBytecode: boolean, + showRevisionInId: boolean, + disableHookSSLValidation: boolean, + enableHttpPostArgs: boolean, + _links: Links }; type Props = { @@ -23,29 +23,26 @@ type Props = { onConfigurationChange: (Configuration, boolean) => void, // context props - t: (string) => string -} + t: string => string +}; type State = Configuration & { validationErrors: string[] }; class HgConfigurationForm extends React.Component { - constructor(props: Props) { super(props); this.state = { ...props.initialConfiguration, validationErrors: [] }; } updateValidationStatus = () => { - const requiredFields = [ - "hgBinary", "pythonBinary", "encoding" - ]; + const requiredFields = ["hgBinary", "pythonBinary", "encoding"]; const validationErrors = []; for (let field of requiredFields) { if (!this.state[field]) { - validationErrors.push( field ); + validationErrors.push(field); } } @@ -56,58 +53,73 @@ class HgConfigurationForm extends React.Component { return validationErrors.length === 0; }; - hasValidationError = (name: string) => { return this.state.validationErrors.indexOf(name) >= 0; }; handleChange = (value: any, name: string) => { - this.setState({ - [name]: value - }, () => this.props.onConfigurationChange(this.state, this.updateValidationStatus())); + this.setState( + { + [name]: value + }, + () => + this.props.onConfigurationChange( + this.state, + this.updateValidationStatus() + ) + ); }; inputField = (name: string) => { const { readOnly, t } = this.props; - return ; + return ( +
+ +
+ ); }; checkbox = (name: string) => { const { readOnly, t } = this.props; - return ; + return ( + + ); }; render() { return ( - <> +
{this.inputField("hgBinary")} {this.inputField("pythonBinary")} {this.inputField("pythonPath")} {this.inputField("encoding")} - {this.checkbox("useOptimizedBytecode")} - {this.checkbox("showRevisionInId")} - {this.checkbox("disableHookSSLValidation")} - {this.checkbox("enableHttpPostArgs")} - +
+ {this.checkbox("useOptimizedBytecode")} + {this.checkbox("showRevisionInId")} +
+
+ {this.checkbox("disableHookSSLValidation")} + {this.checkbox("enableHttpPostArgs")} +
+
); } - } export default translate("plugins")(HgConfigurationForm); diff --git a/scm-ui-components/packages/ui-components/src/Breadcrumb.js b/scm-ui-components/packages/ui-components/src/Breadcrumb.js index 5b0f151c61..74996accc0 100644 --- a/scm-ui-components/packages/ui-components/src/Breadcrumb.js +++ b/scm-ui-components/packages/ui-components/src/Breadcrumb.js @@ -1,10 +1,12 @@ //@flow import React from "react"; -import {Link} from "react-router-dom"; -import type {Branch, Repository} from "@scm-manager/ui-types"; +import { Link } from "react-router-dom"; +import { translate } from "react-i18next"; import injectSheet from "react-jss"; -import {binder, ExtensionPoint} from "@scm-manager/ui-extensions"; import classNames from "classnames"; +import { binder, ExtensionPoint } from "@scm-manager/ui-extensions"; +import type { Branch, Repository } from "@scm-manager/ui-types"; +import Icon from "./Icon"; type Props = { repository: Repository, @@ -14,7 +16,10 @@ type Props = { revision: string, path: string, baseUrl: string, - classes: any + + // Context props + classes: any, + t: string => string }; const styles = { @@ -28,6 +33,9 @@ const styles = { flexStart: { flex: "1" }, + homeIcon: { + lineHeight: "1.5rem" + }, buttonGroup: { alignSelf: "center", paddingRight: "1rem" @@ -45,7 +53,7 @@ class Breadcrumb extends React.Component { if (paths.length - 1 === index) { return (
  • - + {path}
  • @@ -59,19 +67,20 @@ class Breadcrumb extends React.Component { }); return map; } - return
  • ; + return null; } render() { const { - classes, baseUrl, branch, defaultBranch, branches, revision, path, - repository + repository, + classes, + t } = this.props; return ( @@ -84,7 +93,19 @@ class Breadcrumb extends React.Component { )} aria-label="breadcrumbs" > -
      {this.renderPath()}
    +
      +
    • + + + +
    • + {this.renderPath()} +
    {binder.hasExtension("repos.sources.actionbar") && (
    @@ -112,4 +133,4 @@ class Breadcrumb extends React.Component { } } -export default injectSheet(styles)(Breadcrumb); +export default translate("commons")(injectSheet(styles)(Breadcrumb)); diff --git a/scm-ui-components/packages/ui-components/src/Help.js b/scm-ui-components/packages/ui-components/src/Help.js index 9cb37e722d..6b632810e9 100644 --- a/scm-ui-components/packages/ui-components/src/Help.js +++ b/scm-ui-components/packages/ui-components/src/Help.js @@ -1,8 +1,9 @@ //@flow import React from "react"; import injectSheet from "react-jss"; -import Tooltip from './Tooltip'; -import HelpIcon from './HelpIcon'; +import classNames from "classnames"; +import Tooltip from "./Tooltip"; +import HelpIcon from "./HelpIcon"; const styles = { tooltip: { @@ -14,21 +15,22 @@ const styles = { type Props = { message: string, + className?: string, classes: any -} +}; class Help extends React.Component { - render() { - const { message, classes } = this.props; + const { message, className, classes } = this.props; return ( - + ); } - } export default injectSheet(styles)(Help); - diff --git a/scm-ui-components/packages/ui-components/src/HelpIcon.js b/scm-ui-components/packages/ui-components/src/HelpIcon.js index 9e095bd8a7..c73417bb27 100644 --- a/scm-ui-components/packages/ui-components/src/HelpIcon.js +++ b/scm-ui-components/packages/ui-components/src/HelpIcon.js @@ -1,22 +1,24 @@ //@flow import React from "react"; import injectSheet from "react-jss"; -import classNames from "classnames"; +import Icon from "./Icon"; type Props = { classes: any }; const styles = { - textinfo: { - color: "#98d8f3 !important" - } + textinfo: { + color: "#98d8f3 !important" + } }; class HelpIcon extends React.Component { render() { const { classes } = this.props; - return ; + return ( + + ); } } diff --git a/scm-ui-components/packages/ui-components/src/Icon.js b/scm-ui-components/packages/ui-components/src/Icon.js index b3b9a9b4c2..255e3ef6cd 100644 --- a/scm-ui-components/packages/ui-components/src/Icon.js +++ b/scm-ui-components/packages/ui-components/src/Icon.js @@ -4,22 +4,26 @@ import classNames from "classnames"; type Props = { title?: string, - name: string -} + name: string, + color: string, + className?: string +}; export default class Icon extends React.Component { + static defaultProps = { + color: "grey-light" + }; render() { - const { title, name } = this.props; - if(title) { + const { title, name, color, className } = this.props; + if (title) { return ( - + ); } - return ( - - ); + return ; } - } - diff --git a/scm-ui-components/packages/ui-components/src/MarkdownView.js b/scm-ui-components/packages/ui-components/src/MarkdownView.js index 4620004f59..6176601d68 100644 --- a/scm-ui-components/packages/ui-components/src/MarkdownView.js +++ b/scm-ui-components/packages/ui-components/src/MarkdownView.js @@ -1,11 +1,11 @@ //@flow import React from "react"; -import SyntaxHighlighter from "./SyntaxHighlighter"; -import Markdown from "react-markdown/with-html"; -import {binder} from "@scm-manager/ui-extensions"; -import MarkdownHeadingRenderer from "./MarkdownHeadingRenderer"; import { withRouter } from "react-router-dom"; - +import injectSheet from "react-jss"; +import Markdown from "react-markdown/with-html"; +import { binder } from "@scm-manager/ui-extensions"; +import SyntaxHighlighter from "./SyntaxHighlighter"; +import MarkdownHeadingRenderer from "./MarkdownHeadingRenderer"; type Props = { content: string, @@ -14,11 +14,34 @@ type Props = { enableAnchorHeadings: boolean, // context props + classes: any, location: any }; -class MarkdownView extends React.Component { +const styles = { + markdown: { + "& > .content": { + "& > h1, h2, h3, h4, h5, h6": { + margin: "0.5rem 0", + fontSize: "0.9rem" + }, + "& > h1": { + fontWeight: "700" + }, + "& > h2": { + fontWeight: "600" + }, + "& > h3, h4, h5, h6": { + fontWeight: "500" + }, + "& strong": { + fontWeight: "500" + } + } + } +}; +class MarkdownView extends React.Component { static defaultProps = { enableAnchorHeadings: false }; @@ -45,16 +68,22 @@ class MarkdownView extends React.Component { } render() { - const {content, renderers, renderContext, enableAnchorHeadings} = this.props; + const { + content, + renderers, + renderContext, + enableAnchorHeadings, + classes + } = this.props; const rendererFactory = binder.getExtension("markdown-renderer-factory"); let rendererList = renderers; - if (rendererFactory){ + if (rendererFactory) { rendererList = rendererFactory(renderContext); } - if (!rendererList){ + if (!rendererList) { rendererList = {}; } @@ -62,12 +91,12 @@ class MarkdownView extends React.Component { rendererList.heading = MarkdownHeadingRenderer; } - if (!rendererList.code){ + if (!rendererList.code) { rendererList.code = SyntaxHighlighter; } return ( -
    (this.contentRef = el)}> +
    (this.contentRef = el)}> { } } -export default withRouter(MarkdownView); +export default injectSheet(styles)(withRouter(MarkdownView)); diff --git a/scm-ui-components/packages/ui-components/src/Tag.js b/scm-ui-components/packages/ui-components/src/Tag.js new file mode 100644 index 0000000000..6ccdf0093f --- /dev/null +++ b/scm-ui-components/packages/ui-components/src/Tag.js @@ -0,0 +1,60 @@ +//@flow +import * as React from "react"; +import classNames from "classnames"; + +type Props = { + className?: string, + color: string, + icon?: string, + label: string, + title?: string, + onClick?: () => void, + onRemove?: () => void +}; + +class Tag extends React.Component { + static defaultProps = { + color: "light" + }; + + render() { + const { + className, + color, + icon, + label, + title, + onClick, + onRemove + } = this.props; + let showIcon = null; + if (icon) { + showIcon = ( + <> + +   + + ); + } + let showDelete = null; + if (onRemove) { + showDelete = ; + } + + return ( + <> + + {showIcon} + {label} + + {showDelete} + + ); + } +} + +export default Tag; diff --git a/scm-ui-components/packages/ui-components/src/buttons/AddButton.js b/scm-ui-components/packages/ui-components/src/buttons/AddButton.js index 8f46fb66a4..b5ad8d23ff 100644 --- a/scm-ui-components/packages/ui-components/src/buttons/AddButton.js +++ b/scm-ui-components/packages/ui-components/src/buttons/AddButton.js @@ -1,11 +1,11 @@ -//@flow -import React from "react"; -import Button, { type ButtonProps } from "./Button"; - -class AddButton extends React.Component { - render() { - return + ); + } + return ( ); - }; - + } } export default withRouter(Button); diff --git a/scm-ui-components/packages/ui-components/src/buttons/ButtonAddons.js b/scm-ui-components/packages/ui-components/src/buttons/ButtonAddons.js index 5b248d64af..4208b34294 100644 --- a/scm-ui-components/packages/ui-components/src/buttons/ButtonAddons.js +++ b/scm-ui-components/packages/ui-components/src/buttons/ButtonAddons.js @@ -14,7 +14,7 @@ class ButtonAddons extends React.Component { const childWrapper = []; React.Children.forEach(children, child => { if (child) { - childWrapper.push(

    {child}

    ); + childWrapper.push(

    {child}

    ); } }); diff --git a/scm-ui-components/packages/ui-components/src/buttons/DeleteButton.js b/scm-ui-components/packages/ui-components/src/buttons/DeleteButton.js index ad67d50b5f..644b713f00 100644 --- a/scm-ui-components/packages/ui-components/src/buttons/DeleteButton.js +++ b/scm-ui-components/packages/ui-components/src/buttons/DeleteButton.js @@ -4,7 +4,7 @@ import Button, { type ButtonProps } from "./Button"; class DeleteButton extends React.Component { render() { - return