Skip to content

Commit

Permalink
fix: Toggle extra column in useGrowingTextField.stories.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
0ces committed Oct 25, 2024
1 parent 39a5a84 commit f1b02b4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/inputs/hooks/useGrowingTextField.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import { withRouter, zeroTo } from "src/utils/sb";
import { SelectField } from "../SelectField";

export default {
component: GridTable,
parameters: { layout: "fullscreen", backgrounds: { default: "white" } },
decorators: [withRouter()],
} as Meta;

export function InVirtualizedTable() {
const [extraColumn, setExtraColumn] = useState(false);
const [extraColumn, setExtraColumn] = useState(true);
const loadRows = useCallback((offset: number) => {
return zeroTo(50).map((i) => ({
kind: "data" as const,
Expand Down Expand Up @@ -67,6 +66,12 @@ export function InVirtualizedTable() {
);
}

InVirtualizedTable.play = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
const button = canvasElement.querySelector("button");
// When we toggle the extra column, the table will re-render
button?.click();
};

type HeaderRow = { kind: "header"; data: undefined };
type ChildRow = { kind: "data"; id: string; data: { name: string; value: number } };

Expand Down

0 comments on commit f1b02b4

Please sign in to comment.