Skip to content

Root: ui|v2.5|src|components|List|Filters: StashIDFilter.tsx

Serechops edited this page Apr 10, 2024 · 1 revision

StashIDFilter.tsx

This file contains a React functional component StashIDFilter used to filter based on stash ID values. Here's an explanation of its structure and functionality:

  1. Imports: The file imports necessary modules and components from React, react-bootstrap, and react-intl.

  2. StashIDFilter Component:

    • This component renders input fields for filtering based on stash ID values.
    • It consists of two input fields: one for the endpoint and another for the stash ID.
    • Users can input values into these fields to filter stash IDs.
    • The component handles changes in the input fields and triggers the onValueChanged function with updated stash ID values.
  3. Props:

    • criterion: An object representing the criterion for filtering stash IDs.
    • onValueChanged: A function triggered when the stash ID value is changed, taking the updated stash ID value as a parameter.
  4. Example Usage:

import { StashIDFilter } from "./StashIDFilter";

// Inside a React component
const initialCriterion = {
  // Initial criterion object
  value: {
    endpoint: "", // Initial endpoint value
    stashID: "", // Initial stash ID value
  },
  modifier: "Equals", // Initial modifier for filtering
  criterionOption: {
    // Initial criterion options
    modifierOptions: ["Equals", "NotEquals"], // Modifier options
  },
};

const handleCriterionChange = (updatedCriterion) => {
  console.log("Updated criterion:", updatedCriterion);
};

<StashIDFilter 
  criterion={initialCriterion} 
  onValueChanged={handleCriterionChange} 
/>

Explanation:

This will render input fields for filtering stash IDs based on the provided criterion. Users can input values for the endpoint and stash ID, and changes trigger the onValueChanged function with updated stash ID values.

Clone this wiki locally