Skip to content

Commit

Permalink
update demos
Browse files Browse the repository at this point in the history
  • Loading branch information
tlabaj committed Aug 12, 2024
1 parent 3c2e930 commit c0dcaaf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class FormDemo extends Component<FormProps, FormState> {
}

labelHelpRef: React.RefObject<HTMLSpanElement> = React.createRef();
textInputRef: React.useRef<HTMLInputElement> = React.createRef();
textInputRef: React.RefObject<HTMLInputElement> = React.createRef();

handleTextInputChange = (_event: React.FormEvent<HTMLInputElement>, value: string) => {
this.setState({ value, isValid: /^\d+$/.test(value) });
Expand Down Expand Up @@ -112,7 +112,7 @@ export class FormDemo extends Component<FormProps, FormState> {
});
};

onSelect = (_event: React.MouseEvent<Element, MouseEvent> | undefined, selection: string | number | undefined) => {
onSelect = (_ev: any, selection: string | number | undefined) => {
const { selected } = this.state;
if (selection) {
if (selected.includes(selection.toString())) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react';
import { Component } from 'react';
import {
Page,
PageSidebar,
Expand All @@ -25,7 +25,7 @@ export class PageDemo extends Component {
isKebabDropdownOpen: false
};

onNavToggle = (_event: React.MouseEvent) => {
onNavToggle = () => {
this.setState({
isNavOpen: !this.state.isNavOpen
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ export class TableEditableDemo extends React.Component<TableProps, TableState> {
};

// set open state if component closes menu on click (e.g. when you click outside of the menu)
onOpenChange = (isOpen: boolean, rowIndex: string | number | undefined, cellIndex: string | number | undefined) => {
onOpenChange = (isOpen: boolean, rowIndex: number, cellIndex: number) => {
const newRows = Array.from(this.state.rows);
newRows[rowIndex as number].cells[cellIndex].props.isSelectOpen = isOpen;
this.setState({
Expand All @@ -387,8 +387,10 @@ export class TableEditableDemo extends React.Component<TableProps, TableState> {

onToggle = (rowIndex: string | number | undefined, cellIndex: string | number | undefined) => {
const newRows = Array.from(this.state.rows);
newRows[rowIndex as number].cells[cellIndex].props.isSelectOpen =
!newRows[rowIndex as number].cells[cellIndex].props.isSelectOpen;
if (typeof rowIndex !== 'undefined' && typeof rowIndex !== 'undefined') {
newRows[rowIndex as number].cells[cellIndex as number].props.isSelectOpen =
!newRows[rowIndex as number].cells[cellIndex as number].props.isSelectOpen;
}
this.setState({
rows: newRows
});
Expand Down

0 comments on commit c0dcaaf

Please sign in to comment.