mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
clarified ButtonGroup vs ButtonAddons
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { ButtonGroup, Button } from "@scm-manager/ui-components";
|
import { ButtonAddons, Button } from "@scm-manager/ui-components";
|
||||||
import type { Repository } from "@scm-manager/ui-types";
|
import type { Repository } from "@scm-manager/ui-types";
|
||||||
import CloneInformation from "./CloneInformation";
|
import CloneInformation from "./CloneInformation";
|
||||||
import type { Link } from "@scm-manager/ui-types";
|
import type { Link } from "@scm-manager/ui-types";
|
||||||
@@ -95,9 +95,9 @@ class ProtocolInformation extends React.Component<Props, State> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.protocols}>
|
<div className={classes.protocols}>
|
||||||
<ButtonGroup connected={true} className={classes.switcher}>
|
<ButtonAddons className={classes.switcher}>
|
||||||
{protocols.map(this.renderProtocolButton)}
|
{protocols.map(this.renderProtocolButton)}
|
||||||
</ButtonGroup>
|
</ButtonAddons>
|
||||||
{ cloneInformation }
|
{ cloneInformation }
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// @flow
|
||||||
|
import * as React from "react";
|
||||||
|
import classNames from "classnames";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
className?: string,
|
||||||
|
children: React.Node
|
||||||
|
};
|
||||||
|
|
||||||
|
class ButtonAddons extends React.Component<Props> {
|
||||||
|
render() {
|
||||||
|
const { className, children } = this.props;
|
||||||
|
|
||||||
|
var childWrapper = [];
|
||||||
|
React.Children.forEach(children, child => {
|
||||||
|
if (child) {
|
||||||
|
childWrapper.push(<p className="control">{child}</p>);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={classNames("field", "is-addons", className)}>
|
||||||
|
{childWrapper}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ButtonAddons;
|
||||||
@@ -3,22 +3,14 @@ import * as React from "react";
|
|||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
connected?: boolean,
|
|
||||||
addons?: boolean,
|
|
||||||
className?: string,
|
className?: string,
|
||||||
children: React.Node
|
children: React.Node
|
||||||
};
|
};
|
||||||
|
|
||||||
class ButtonGroup extends React.Component<Props> {
|
class ButtonGroup extends React.Component<Props> {
|
||||||
|
|
||||||
static defaultProps = {
|
|
||||||
addons: true
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {connected, addons, className, children} = this.props;
|
const { className, children } = this.props;
|
||||||
|
|
||||||
if (!connected) {
|
|
||||||
var childWrapper = [];
|
var childWrapper = [];
|
||||||
React.Children.forEach(children, child => {
|
React.Children.forEach(children, child => {
|
||||||
if (child) {
|
if (child) {
|
||||||
@@ -32,13 +24,6 @@ class ButtonGroup extends React.Component<Props> {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={classNames("buttons", addons ? "has-addons" : "", className)}>
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ButtonGroup;
|
export default ButtonGroup;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export { default as EditButton } from "./EditButton.js";
|
|||||||
export { default as SubmitButton } from "./SubmitButton.js";
|
export { default as SubmitButton } from "./SubmitButton.js";
|
||||||
export { default as DownloadButton } from "./DownloadButton.js";
|
export { default as DownloadButton } from "./DownloadButton.js";
|
||||||
export { default as ButtonGroup } from "./ButtonGroup.js";
|
export { default as ButtonGroup } from "./ButtonGroup.js";
|
||||||
|
export { default as ButtonAddons } from "./ButtonAddons.js";
|
||||||
export {
|
export {
|
||||||
default as RemoveEntryOfTableButton
|
default as RemoveEntryOfTableButton
|
||||||
} from "./RemoveEntryOfTableButton.js";
|
} from "./RemoveEntryOfTableButton.js";
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ class DiffFile extends React.Component<Props, State> {
|
|||||||
{this.renderChangeTag(file)}
|
{this.renderChangeTag(file)}
|
||||||
</div>
|
</div>
|
||||||
<div className={classNames("level-right", classes.buttonHeader)}>
|
<div className={classNames("level-right", classes.buttonHeader)}>
|
||||||
<ButtonGroup connected={false}>
|
<ButtonGroup>
|
||||||
<Button
|
<Button
|
||||||
action={this.toggleSideBySide}
|
action={this.toggleSideBySide}
|
||||||
className="reduced-mobile"
|
className="reduced-mobile"
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type { Changeset, Repository } from "@scm-manager/ui-types";
|
import type { Changeset, Repository } from "@scm-manager/ui-types";
|
||||||
import ButtonGroup from "../../buttons/ButtonGroup";
|
import { ButtonAddons, Button } from "../../buttons";
|
||||||
import Button from "../../buttons/Button";
|
|
||||||
import { createChangesetLink, createSourcesLink } from "./changesets";
|
import { createChangesetLink, createSourcesLink } from "./changesets";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
|
|
||||||
@@ -22,7 +21,7 @@ class ChangesetButtonGroup extends React.Component<Props> {
|
|||||||
const sourcesLink = createSourcesLink(repository, changeset);
|
const sourcesLink = createSourcesLink(repository, changeset);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ButtonGroup connected={true} className="is-pulled-right">
|
<ButtonAddons className="is-pulled-right">
|
||||||
<Button link={changesetLink} className="reduced-mobile">
|
<Button link={changesetLink} className="reduced-mobile">
|
||||||
<span className="icon">
|
<span className="icon">
|
||||||
<i className="fas fa-exchange-alt" />
|
<i className="fas fa-exchange-alt" />
|
||||||
@@ -35,7 +34,7 @@ class ChangesetButtonGroup extends React.Component<Props> {
|
|||||||
</span>
|
</span>
|
||||||
<span>{t("changeset.buttons.sources")}</span>
|
<span>{t("changeset.buttons.sources")}</span>
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonGroup>
|
</ButtonAddons>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type { Repository, Branch } from "@scm-manager/ui-types";
|
import type { Repository, Branch } from "@scm-manager/ui-types";
|
||||||
import { ButtonGroup, Button } from "@scm-manager/ui-components";
|
import { ButtonAddons, Button } from "@scm-manager/ui-components";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -24,7 +24,7 @@ class BranchButtonGroup extends React.Component<Props> {
|
|||||||
}/sources/${encodeURIComponent(branch.name)}/`;
|
}/sources/${encodeURIComponent(branch.name)}/`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ButtonGroup connected={true}>
|
<ButtonAddons>
|
||||||
<Button link={changesetLink} className="reduced-mobile">
|
<Button link={changesetLink} className="reduced-mobile">
|
||||||
<span className="icon">
|
<span className="icon">
|
||||||
<i className="fas fa-exchange-alt" />
|
<i className="fas fa-exchange-alt" />
|
||||||
@@ -37,7 +37,7 @@ class BranchButtonGroup extends React.Component<Props> {
|
|||||||
</span>
|
</span>
|
||||||
<span>{t("branch.sources")}</span>
|
<span>{t("branch.sources")}</span>
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonGroup>
|
</ButtonAddons>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class AdvancedPermissionsDialog extends React.Component<Props, State> {
|
|||||||
|
|
||||||
const footer = (
|
const footer = (
|
||||||
<form onSubmit={this.onSubmit}>
|
<form onSubmit={this.onSubmit}>
|
||||||
<ButtonGroup connected={false}>
|
<ButtonGroup>
|
||||||
{submitButton}
|
{submitButton}
|
||||||
<Button
|
<Button
|
||||||
label={t("permission.advanced.dialog.abort")}
|
label={t("permission.advanced.dialog.abort")}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import { ButtonGroup, Button } from "@scm-manager/ui-components";
|
import { ButtonAddons, Button } from "@scm-manager/ui-components";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
t: string => string,
|
t: string => string,
|
||||||
@@ -26,7 +26,7 @@ class FileButtonGroup extends React.Component<Props> {
|
|||||||
const { t, historyIsSelected } = this.props;
|
const { t, historyIsSelected } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ButtonGroup connected={true}>
|
<ButtonAddons>
|
||||||
<Button
|
<Button
|
||||||
action={this.showSources}
|
action={this.showSources}
|
||||||
className="reduced-mobile"
|
className="reduced-mobile"
|
||||||
@@ -47,7 +47,7 @@ class FileButtonGroup extends React.Component<Props> {
|
|||||||
</span>
|
</span>
|
||||||
<span>{t("sources.content.historyButton")}</span>
|
<span>{t("sources.content.historyButton")}</span>
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonGroup>
|
</ButtonAddons>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user