mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Lens app source code (#119)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
936cbd53d4
commit
1d0815abd2
797 files changed
+73714
-215
No files matched your search
@@ -0,0 +1,15 @@
|
||||
.AddRemoveButtons {
|
||||
position: absolute;
|
||||
margin: $padding * 2;
|
||||
margin-right: $padding * 4;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 99;
|
||||
|
||||
.Button {
|
||||
&.remove-button {
|
||||
background-color: $borderFaintColor;
|
||||
color: $textColorPrimary;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import "./add-remove-buttons.scss";
|
||||
|
||||
import * as React from "react";
|
||||
import { cssNames } from "../../utils";
|
||||
import { Button } from "../button";
|
||||
import { Icon } from "../icon";
|
||||
|
||||
export interface AddRemoveButtonsProps extends React.HTMLAttributes<any> {
|
||||
onAdd?: () => void;
|
||||
onRemove?: () => void;
|
||||
addTooltip?: React.ReactNode;
|
||||
removeTooltip?: React.ReactNode;
|
||||
}
|
||||
|
||||
export class AddRemoveButtons extends React.PureComponent<AddRemoveButtonsProps> {
|
||||
renderButtons() {
|
||||
const { onRemove, onAdd, addTooltip, removeTooltip } = this.props
|
||||
const buttons = [
|
||||
{
|
||||
onClick: onRemove,
|
||||
className: "remove-button",
|
||||
icon: "remove",
|
||||
tooltip: removeTooltip,
|
||||
},
|
||||
{
|
||||
onClick: onAdd,
|
||||
className: "add-button",
|
||||
icon: "add",
|
||||
tooltip: addTooltip,
|
||||
},
|
||||
];
|
||||
return buttons.map(button => {
|
||||
if (!button.onClick) {
|
||||
return null;
|
||||
}
|
||||
const { onClick, className, icon, tooltip } = button
|
||||
return (
|
||||
<Button key={icon} big round primary onClick={onClick} className={className} tooltip={tooltip}>
|
||||
<Icon material={icon}/>
|
||||
</Button>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className={cssNames("AddRemoveButtons flex gaps", this.props.className)}>
|
||||
{this.renderButtons()}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./add-remove-buttons"
|
||||
Reference in new issue
Block a user