add button

This commit is contained in:
ari committed 2021-11-25 14:03:15 -05:00
1 parent 13c9ede31c
commit 844145aeaf
3 files changed
+59

No files matched your search

@@ -0,0 +1,11 @@
.dag-svg--add-btn > a {
height: 100%;
width: 100%;
}
.dag-svg--add-btn > a:hover > svg {
fill: rgb(48, 189, 59);
}
.dag-svg--add-btn:hover {
cursor: pointer;
}
@@ -0,0 +1,24 @@
import React from "react";
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { SVGBoard } from './Board';
import { AddButton } from "./AddButton";
export default {
title: 'DAGSvgs/AddButton',
component: AddButton,
parameters: { actions: { argTypesRegex: '^on.*' } },
args: {
height: 10,
width: 10,
loc: [50, 50]
}
} as ComponentMeta<typeof AddButton>
export const Basic: ComponentStory<typeof AddButton> = args => {
return <SVGBoard>
<AddButton
{...args}
/>
</SVGBoard>
}
@@ -0,0 +1,24 @@
import "./AddButton.css";
import { Point } from "types/graphs";
import { AddIcon } from '../Icons/index';
export interface AddProps {
onClick?: () => void;
loc: Point,
height: number,
width: number,
}
export const AddButton = ({
loc: [x, y],
height,
width,
onClick = () => { },
}: AddProps) => {
return <>
<foreignObject className="dag-svg--add-btn" x={x} y={y} width={width} height={height}>
<AddIcon onClick={onClick} />
</foreignObject>
</>
}