Skip to content

Commit

Permalink
chore: add wrapper components for split and merge functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Jipperism committed Oct 31, 2023
1 parent a99e85e commit fe9b359
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
26 changes: 26 additions & 0 deletions frontend/components/merge-all-claim-fractions-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import { Button } from "@mui/material";

interface Props {
claimId: string;
text?: string;
disabled?: boolean;
className?: string;
}

export function MergeAllClaimFractionsButton({
text,
claimId,
className,
disabled,
}: Props) {
const onClick = async () => {
console.log("Merging all claim fractions", claimId);
};

return (
<Button disabled={disabled} className={className} onClick={onClick}>
{text}
</Button>
);
}
24 changes: 24 additions & 0 deletions frontend/components/split-fraction-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Button } from "@mui/material";

interface Props {
fractionId: string;
text?: string;
disabled?: boolean;
className?: string;
}
export function SplitFractionButton({
fractionId,
text,
className,
disabled,
}: Props) {
const onClick = async () => {
console.log("Splitting fraction", fractionId);
};

return (
<Button className={className} disabled={disabled} onClick={onClick}>
{text}
</Button>
);
}
35 changes: 35 additions & 0 deletions frontend/plasmic-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import { initPlasmicLoader } from "@plasmicapp/loader-nextjs";
import dynamic from "next/dynamic";
import "primereact/resources/primereact.min.css";
import "primereact/resources/themes/tailwind-light/theme.css";
import { MergeAllClaimFractionsButton } from "./components/merge-all-claim-fractions-button";
import { SplitFractionButton } from "./components/split-fraction-button";

export const PLASMIC = initPlasmicLoader({
projects: [
Expand Down Expand Up @@ -682,3 +684,36 @@ PLASMIC.registerComponent(ProjectsClientProvider, {
width: "Full bleed",
},
});

PLASMIC.registerComponent(MergeAllClaimFractionsButton, {
name: "MergeAllClaimFractionsButton",
description:
"Button that will merge all fractions in selected claim owned by current owner upon clicking",
props: {
className: "string",
claimId: "string",
disabled: "boolean",
text: {
type: "string",
defaultValue: "Split",
helpText: "Text to display on button",
},
},
importPath: "./components/merge-all-claim-fractions-button",
});

PLASMIC.registerComponent(SplitFractionButton, {
name: "SplitFractionButton",
description: "Button that will split the fraction currently selected",
props: {
text: {
type: "string",
defaultValue: "Split",
helpText: "Text to display on button",
},
fractionId: "string",
disabled: "boolean",
className: "string",
},
importPath: "./components/split-fraction-button",
});

0 comments on commit fe9b359

Please sign in to comment.