Skip to content

Commit

Permalink
Merge pull request #48 from abusix/pla-711-create-panel-component-in-…
Browse files Browse the repository at this point in the history
…hailstorm

Pla 711 create panel component
  • Loading branch information
rodelta authored Oct 12, 2023
2 parents 4496bcd + 1241ceb commit 6ccaf88
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ module.exports = {
semi: true,
singleQuote: false,
printWidth: 100,
// tailwind pluging config
plugins: ["prettier-plugin-tailwindcss"],
tailwindConfig: "./tailwind.config.cjs",
};
24 changes: 11 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
"eslint-plugin-storybook": "0.6.13",
"eslint-plugin-tsdoc": "0.2.17",
"jsdom": "^22.1.0",
"prettier": "^3.0.0",
"prettier-plugin-tailwindcss": "0.3.0",
"prettier": "^3.0.3",
"prettier-plugin-tailwindcss": "0.5.5",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions src/components/dialog/dialog.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Meta, StoryObj } from "@storybook/react";

import React, { useState } from "react";
import { Dialog } from "./dialog";
import { getStoryDescription, hiddenArgControl } from "../../util/storybook-utils";
import { Dialog } from "./dialog";

const SpanFooter = () => <span>test footer 🍭</span>;
const footerOptions = { undefined, SpanFooter: <SpanFooter /> };
Expand Down Expand Up @@ -39,7 +39,7 @@ const meta: Meta<typeof Dialog> = {
<button
type="button"
onClick={toggleBtn}
className="bg-neutral-100 py-2 px-4 shadow"
className="bg-neutral-100 px-4 py-2 shadow"
>
show Modal
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const SingleComboboxInput = <TValue,>({
placeholder={placeholder}
displayValue={displayValue}
onChange={onChange}
className="paragraph-100 flex h-8 w-full items-center rounded border border-neutral-400 py-2 pl-3 pr-8 focus-visible:border-primary-400 focus-visible:ring-2 focus-visible:ring-primary-200 disabled:bg-neutral-100 disabled:text-neutral-600 disabled:border-neutral-300"
className="paragraph-100 flex h-8 w-full items-center rounded border border-neutral-400 py-2 pl-3 pr-8 focus-visible:border-primary-400 focus-visible:ring-2 focus-visible:ring-primary-200 disabled:border-neutral-300 disabled:bg-neutral-100 disabled:text-neutral-600"
/>
{showButton ? (
<HeadlessCombobox.Button className="absolute inset-y-0 right-0 flex items-center px-1.5">
Expand Down
2 changes: 1 addition & 1 deletion src/components/form-field/text-input/text-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const TextInput = ({
<div className={classNames("relative w-full", formFieldGroupStyles)}>
{LeftIcon ? (
<div
className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 z-10"
className="pointer-events-none absolute inset-y-0 left-0 z-10 flex items-center pl-3"
aria-hidden="true"
>
<LeftIcon className="text-gray-400 h-3.5 w-3.5 fill-neutral-600" />
Expand Down
3 changes: 2 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export { Alert, AlertIntent } from "./alert";
export { InlineAlert } from "./inline-alert";
export { Avatar } from "./avatar";
export { Badge } from "./badge";
export { Button } from "./button";
Expand All @@ -8,9 +7,11 @@ export { Dialog } from "./dialog";
export { DividerLine } from "./divider-line";
export { FormField } from "./form-field";
export { IconButton } from "./icon-button";
export { InlineAlert } from "./inline-alert";
export { LastChangedInfo } from "./last-changed-info";
export { Menu } from "./menu";
export { Page } from "./page";
export { Panel } from "./panel";
export { Section } from "./section";
export { Sidebar } from "./sidebar";
export { SidebarContainer } from "./sidebar-container";
Expand Down
1 change: 1 addition & 0 deletions src/components/panel/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Panel } from "./panel";
44 changes: 44 additions & 0 deletions src/components/panel/panel.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import type { Meta, StoryObj } from "@storybook/react";
import React from "react";
import { Panel } from "./panel";
import { Button } from "../button/button";
import { getStoryDescription } from "../../util/storybook-utils";
import { Toggle } from "../toggle";

const meta: Meta<typeof Panel> = {
title: "Panel",
parameters: {
...getStoryDescription("Simple container used to group and organize elements in the UI."),
backgrounds: {
default: "light",
},
},
component: Panel,
args: {
className: "",
children: "Panel with text content",
},
};

export default meta;
type Story = StoryObj<typeof Panel>;

export const Default: Story = {};

const noop = () => undefined;
export const WithComponents: Story = {
args: {
children: (
<>
<Button variant="primary" onClick={noop}>
Button A
</Button>
<Toggle checked ariaLabel="test" onChange={noop} />
<Button variant="secondary" onClick={noop}>
Button B
</Button>
<p> Paragraph content</p>
</>
),
},
};
13 changes: 13 additions & 0 deletions src/components/panel/panel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React, { FC, ReactNode } from "react";
import { classNames } from "../../util/class-names";

interface PanelProps {
children: ReactNode;
className?: string;
}

export const Panel: FC<PanelProps> = ({ children, className }) => (
<div className={classNames("rounded border border-neutral-300 bg-neutral-0 p-5", className)}>
{children}
</div>
);
4 changes: 4 additions & 0 deletions src/components/section/section-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ export interface SectionPanelProps {
children: React.ReactNode;
}

/**
* @deprecated Use the dedicated Panel component
* Delete me on version 3
*/
export const SectionPanel = ({ children }: SectionPanelProps) => {
return (
<div className="relative rounded border border-neutral-300 bg-neutral-0 p-5">
Expand Down
3 changes: 3 additions & 0 deletions src/components/section/section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const Section = ({ children }: SectionProps) => {
Section.TitleGroup = SectionTitleGroup;
Section.Title = SectionTitle;
Section.Description = SectionDescription;
/**
* @deprecated Use the dedicated Panel component
*/
Section.Panel = SectionPanel;

export { Section };
12 changes: 5 additions & 7 deletions src/components/table-virtualized/table-virtualized.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@ import { useVirtualizer, VirtualizerOptions } from "@tanstack/react-virtual";
import React from "react";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import { classNames } from "../../util/class-names";
import { TableUnvirtualized } from "../table-unvirtualized";
import { DraggableRow } from "./draggable-row/draggable-row";
import { VirtualizedHeaderGroup } from "./header-group/header-group";
import { ExpandableButtonCell } from "./expandable-button-cell/expandable-button-cell";
import { TableUnvirtualized } from "../table-unvirtualized";
import { classNames } from "../../util/class-names";
import { VirtualizedHeaderGroup } from "./header-group/header-group";

export interface TableVirtualizedProps<TableData> {
export interface TableVirtualizedProps<TableData, TableValue = unknown> {
data: TableData[];
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
columnDefs: ColumnDef<TableData, any>[];
columnDefs: ColumnDef<TableData, TableValue>[];
showPlaceholder?: boolean;
placeholder?: React.ReactNode;
isDraggableRowsEnabled?: boolean;
Expand Down

0 comments on commit 6ccaf88

Please sign in to comment.