@peerbots/core 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/ui/index.ts +0 -1
- package/src/ui/BasePanel.stories.tsx +0 -36
- package/src/ui/BasePanel.tsx +0 -59
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @peerbots/core
|
|
2
2
|
|
|
3
|
+
## 0.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e8744e4`](https://github.com/PEERbots/peerbots-core/commit/e8744e47d7a64bdf61b6dfcc23311b940e390b3d) Thanks [@sbeleidy](https://github.com/sbeleidy)! - Remove BasePanel since it's more of a peerbots-controller component
|
|
8
|
+
|
|
3
9
|
## 0.2.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
package/src/ui/index.ts
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { BasePanel } from "./BasePanel";
|
|
3
|
-
import { Text as UIText } from "./Typography";
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: "UI/BasePanel",
|
|
7
|
-
component: BasePanel,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: "centered",
|
|
10
|
-
},
|
|
11
|
-
decorators: [
|
|
12
|
-
(Story) => (
|
|
13
|
-
<div className="pb:w-[450px] pb:rounded-lg pb:shadow-sm pb:bg-white pb:overflow-hidden pb:p-4">
|
|
14
|
-
<Story />
|
|
15
|
-
</div>
|
|
16
|
-
),
|
|
17
|
-
],
|
|
18
|
-
tags: ["autodocs"],
|
|
19
|
-
} satisfies Meta<typeof BasePanel>;
|
|
20
|
-
|
|
21
|
-
export default meta;
|
|
22
|
-
type Story = StoryObj<typeof meta>;
|
|
23
|
-
|
|
24
|
-
export const Default: Story = {
|
|
25
|
-
args: {
|
|
26
|
-
title: "Example Panel",
|
|
27
|
-
children: (
|
|
28
|
-
<UIText
|
|
29
|
-
variant="small"
|
|
30
|
-
className="pb:p-4 pb:bg-gray-50 pb:rounded-md pb:border pb:border-gray-100 pb:text-black pb:text-center"
|
|
31
|
-
>
|
|
32
|
-
Panel content goes here.
|
|
33
|
-
</UIText>
|
|
34
|
-
),
|
|
35
|
-
},
|
|
36
|
-
};
|
package/src/ui/BasePanel.tsx
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { Heading, Button, Icon } from "./";
|
|
3
|
-
|
|
4
|
-
export interface BasePanelProps {
|
|
5
|
-
title: string;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
onClose?: () => void;
|
|
8
|
-
className?: string;
|
|
9
|
-
headerClassName?: string;
|
|
10
|
-
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
11
|
-
setPanel: (panel: string) => void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function BasePanel({
|
|
15
|
-
title,
|
|
16
|
-
children,
|
|
17
|
-
onClose,
|
|
18
|
-
className = "",
|
|
19
|
-
headerClassName = "",
|
|
20
|
-
headingLevel = 2,
|
|
21
|
-
setPanel = (panel: string) => { }
|
|
22
|
-
}: BasePanelProps) {
|
|
23
|
-
|
|
24
|
-
const handleClose = () => {
|
|
25
|
-
if (onClose) {
|
|
26
|
-
onClose();
|
|
27
|
-
} else {
|
|
28
|
-
setPanel("None");
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div className={`pb:space-y-1 pb:p-1 ${className}`}>
|
|
34
|
-
<div
|
|
35
|
-
className={`pb:flex pb:items-center pb:justify-between pb:px-1 pb:mb-1 pb:pb-1 ${headerClassName}`}
|
|
36
|
-
>
|
|
37
|
-
<Heading level={headingLevel} className="pb:text-lg">
|
|
38
|
-
{title}
|
|
39
|
-
</Heading>
|
|
40
|
-
<Button
|
|
41
|
-
variant="ghost"
|
|
42
|
-
size="sm"
|
|
43
|
-
onClick={handleClose}
|
|
44
|
-
className="pb:p-1 pb:rounded pb:hover:bg-gray-100 pb:h-auto"
|
|
45
|
-
aria-label={`Close ${title} Panel`}
|
|
46
|
-
>
|
|
47
|
-
<Icon size="md" className="pb:h-5 pb:w-5">
|
|
48
|
-
<path
|
|
49
|
-
strokeLinecap="round"
|
|
50
|
-
strokeLinejoin="round"
|
|
51
|
-
d="M6 18 18 6M6 6l12 12"
|
|
52
|
-
/>
|
|
53
|
-
</Icon>
|
|
54
|
-
</Button>
|
|
55
|
-
</div>
|
|
56
|
-
{children}
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
}
|