This commit is contained in:
Florian Scholdei
2019-01-29 09:17:14 +01:00
28 changed files with 194 additions and 114 deletions

View File

@@ -25,13 +25,13 @@ class LinkPaginator extends React.Component<Props> {
);
}
renderPreviousButton(label?: string) {
renderPreviousButton(className: string, label?: string) {
const { page } = this.props;
const previousPage = page - 1;
return (
<Button
className={"pagination-previous"}
className={className}
label={label ? label : previousPage.toString()}
disabled={!this.hasLink("prev")}
link={`${previousPage}`}
@@ -44,12 +44,12 @@ class LinkPaginator extends React.Component<Props> {
return collection._links[name];
}
renderNextButton(label?: string) {
renderNextButton(className: string, label?: string) {
const { page } = this.props;
const nextPage = page + 1;
return (
<Button
className={"pagination-next"}
className={className}
label={label ? label : nextPage.toString()}
disabled={!this.hasLink("next")}
link={`${nextPage}`}
@@ -96,13 +96,13 @@ class LinkPaginator extends React.Component<Props> {
links.push(this.separator());
}
if (page > 2) {
links.push(this.renderPreviousButton());
links.push(this.renderPreviousButton("pagination-link"));
}
links.push(this.currentPage(page));
if (page + 1 < pageTotal) {
links.push(this.renderNextButton());
links.push(this.renderNextButton("pagination-link"));
}
if (page + 2 < pageTotal)
//if there exists pages between next and last
@@ -118,13 +118,13 @@ class LinkPaginator extends React.Component<Props> {
const { t } = this.props;
return (
<nav className="pagination is-centered" aria-label="pagination">
{this.renderPreviousButton(t("paginator.previous"))}
{this.renderPreviousButton("pagination-previous", t("paginator.previous"))}
<ul className="pagination-list">
{this.pageLinks().map((link, index) => {
return <li key={index}>{link}</li>;
})}
</ul>
{this.renderNextButton(t("paginator.next"))}
{this.renderNextButton("pagination-next", t("paginator.next"))}
</nav>
);
}

View File

@@ -1,7 +1,5 @@
//@flow
import React from "react";
import Button, { type ButtonProps } from "./Button";
import type {File} from "@scm-manager/ui-types";
type Props = {
displayName: string,
@@ -10,9 +8,9 @@ type Props = {
class DownloadButton extends React.Component<Props> {
render() {
const {displayName, url} = this.props;
const { displayName, url } = this.props;
return (
<a className="button is-large is-info" href={url}>
<a className="button is-large is-link" href={url}>
<span className="icon is-medium">
<i className="fas fa-arrow-circle-down" />
</span>

View File

@@ -0,0 +1,45 @@
//@flow
import React from "react";
import { Help } from "../index";
type Props = {
label?: string,
name?: string,
value?: string,
checked: boolean,
onChange?: (value: boolean, name?: string) => void,
disabled?: boolean,
helpText?: string
};
class Radio extends React.Component<Props> {
renderHelp = () => {
const helpText = this.props.helpText;
if (helpText) {
return <Help message={helpText} />;
}
};
render() {
return (
<div className="field is-grouped">
<div className="control">
<label className="radio" disabled={this.props.disabled}>
<input
type="radio"
name={this.props.name}
value={this.props.value}
checked={this.props.checked}
onChange={this.props.onChange}
disabled={this.props.disabled}
/>{" "}
{this.props.label}
{this.renderHelp()}
</label>
</div>
</div>
);
}
}
export default Radio;

View File

@@ -4,6 +4,7 @@ export { default as AddEntryToTableField } from "./AddEntryToTableField.js";
export { default as AutocompleteAddEntryToTableField } from "./AutocompleteAddEntryToTableField.js";
export { default as MemberNameTable } from "./MemberNameTable.js";
export { default as Checkbox } from "./Checkbox.js";
export { default as Radio } from "./Radio.js";
export { default as InputField } from "./InputField.js";
export { default as Select } from "./Select.js";
export { default as Textarea } from "./Textarea.js";

View File

@@ -43,6 +43,7 @@ class ConfirmAlert extends React.Component<Props> {
<button
key={i}
onClick={() => this.handleClickButton(button)}
href="javascript:void(0);"
>
{button.label}
</button>

View File

@@ -18,7 +18,7 @@ class NavAction extends React.Component<Props> {
return (
<li>
<a onClick={action}>{showIcon}{label}</a>
<a onClick={action} href="javascript:void(0);">{showIcon}{label}</a>
</li>
);
}

View File

@@ -3,15 +3,16 @@ import React from "react";
import type { Changeset, Repository, Tag } from "@scm-manager/ui-types";
import classNames from "classnames";
import {Interpolate, translate} from "react-i18next";
import { Interpolate, translate } from "react-i18next";
import ChangesetId from "./ChangesetId";
import injectSheet from "react-jss";
import {DateFromNow} from "../..";
import { DateFromNow } from "../..";
import ChangesetAuthor from "./ChangesetAuthor";
import ChangesetTag from "./ChangesetTag";
import {parseDescription} from "./changesets";
import {AvatarWrapper, AvatarImage} from "../../avatar";
import { parseDescription } from "./changesets";
import { AvatarWrapper, AvatarImage } from "../../avatar";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
const styles = {
pointer: {
@@ -64,7 +65,15 @@ class ChangesetRow extends React.Component<Props> {
<div className={classNames("media-content", classes.withOverflow)}>
<div className="content">
<p className="is-ellipsis-overflow">
<strong>{description.title}</strong>
<strong>
<ExtensionPoint
name="changesets.changeset.description"
props={{ changeset, value: description.title }}
renderAll={false}
>
{description.title}
</ExtensionPoint>
</strong>
<br />
<Interpolate
i18nKey="changesets.changeset.summary"