components#LoadingIcon TypeScript Examples

The following examples show how to use components#LoadingIcon. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: tableColumns.tsx    From solo with MIT License 4 votes vote down vote up
createColumns: CreateColumns = (
  modifyWarehouseUser,
  updateUserPermissons
) => [
  {
    Header: "Loading",
    id: "loading",
    disableSortBy: true,
    Cell: ({
      row: {
        original: { loading, error }
      }
    }) => <LoadingIcon loading={loading} error={error} />
  },
  {
    Header: "AAC",
    accessor: "aac"
  },
  {
    Header: "First Name",
    accessor: "first_name"
  },
  {
    Header: "Last Name",
    accessor: "last_name"
  },
  {
    Header: "DODID",
    accessor: "username"
  },
  {
    Header: "D6T",
    id: "canD6T",
    disableSortBy: true,
    Cell: ({
      row: {
        original: { canD6T, userId }
      }
    }) => {
      return (
        <div className="padding-left-2">
          <Checkbox
            data-testid="has-d6t-checkbox"
            checked={canD6T}
            onChange={e => {
              modifyWarehouseUser(userId, {
                canD6T: e.target.checked
              });
            }}
          />
        </div>
      );
    }
  },
  {
    Header: "COR",
    id: "canCOR",
    disableSortBy: true,
    Cell: ({
      row: {
        original: { userId, canCOR }
      }
    }) => {
      return (
        <div className="padding-left-2">
          <Checkbox
            data-testid="has-cor-checkbox"
            checked={canCOR}
            onChange={e => {
              modifyWarehouseUser(userId, {
                canCOR: e.target.checked
              });
            }}
          />
        </div>
      );
    }
  },
  {
    Header: "Submit Permissions",
    id: "submit",
    disableSortBy: true,
    Cell: ({
      row: {
        original: { userId, hasModified }
      }
    }) => {
      return (
        <div className="padding-left-2">
          <Button
            disabled={!hasModified}
            onClick={() => {
              updateUserPermissons(userId);
            }}
          >
            Submit
          </Button>
        </div>
      );
    }
  }
]
Example #2
Source File: tableColumns.tsx    From solo with MIT License 4 votes vote down vote up
createColumns: CreateColumns = (modifyDocument, removeDocument) => [
  {
    Header: "",
    id: "removeRow",
    Cell: ({
      row: {
        original: { sdn }
      }
    }) => (
      <Button onClick={() => removeDocument(sdn)} unstyled>
        <FontAwesomeIcon icon={faTimes} />
      </Button>
    )
  },
  {
    Header: <div className="width-full text-center">Loading</div>,
    id: "loadingStatus",
    disableSortBy: true,
    Cell: ({
      row: {
        original: { loadingStatus }
      }
    }) => (
      <div className="text-center">
        <LoadingIcon {...loadingStatus} />
      </div>
    )
  },
  {
    Header: "SDN",
    accessor: "sdn"
  },
  {
    Header: "NIIN",
    accessor: "part.nsn",
    id: "niin"
  },
  {
    Header: "Nomenclature",
    id: "nomen",
    accessor: "part.nomen"
  },
  {
    Header: "Quantity",
    id: "quantity",
    accessor: ({ sdn, enteredReceivedQty }) => (
      <div className="maxw-8">
        <QuantityInput
          enteredQuantity={enteredReceivedQty}
          onQuantitiyChange={value =>
            modifyDocument(sdn, {
              enteredReceivedQty: value
            })
          }
        />
      </div>
    )
  },
  {
    Header: "Commodity",
    id: "commodity",
    accessor: "commodityName"
  },
  {
    Header: "Subinventory",
    id: "subinventory",
    accessor: ({
      sdn,
      subinventorys,
      enteredSubinventoryCode,
      locatorsBySubinventory
    }) => (
      <>
        {subinventorys && (
          <SubinventorySelector
            subinventorys={subinventorys}
            enteredSubinventoryCode={enteredSubinventoryCode}
            onSelectSubinventory={code => {
              modifyDocument(sdn, {
                enteredSubinventoryCode: code,
                enteredLocatorCode: locatorsBySubinventory[code][0].code
              });
            }}
          />
        )}
      </>
    )
  },
  {
    Header: "Locator",
    id: "locator",
    accessor: ({
      sdn,
      locatorsBySubinventory,
      enteredSubinventoryCode,
      enteredLocatorCode
    }) => (
      <>
        {locatorsBySubinventory && enteredSubinventoryCode && (
          <LocatorSelector
            locators={locatorsBySubinventory[enteredSubinventoryCode]}
            enteredLocatorCode={enteredLocatorCode}
            onSelectLocator={code => {
              modifyDocument(sdn, {
                enteredLocatorCode: code
              });
            }}
          />
        )}
      </>
    )
  }
]