-
-
Notifications
You must be signed in to change notification settings - Fork 12
Root: ui|v2.5|src|components|List|Filters: StashIDFilter.tsx
Serechops edited this page Apr 10, 2024
·
1 revision
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:
-
Imports: The file imports necessary modules and components from React, react-bootstrap, and react-intl.
-
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.
-
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.
-
-
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}
/>
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.