Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2461: UI for Courses #70

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Binary file added public/assets/images/Copy-icon-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/add-ta-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/assign.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/delete-icon-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/edit-icon-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/paste.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/pencil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion src/components/Form/FormSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { IFormikFieldProps, IFormPropsWithOption } from "./interfaces";
* @author Ankur Mundra on May, 2023
*/

const FormSelect: React.FC<IFormPropsWithOption> = (props) => {
const FormSelect: React.FC<IFormPropsWithOption & { onChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void }> = (props) => {
const {
as,
md,
Expand All @@ -21,6 +21,7 @@ const FormSelect: React.FC<IFormPropsWithOption> = (props) => {
tooltipPlacement,
disabled,
inputGroupPrepend,
onChange, // Add onChange to props to detect chnage in selected institutions.
} = props;

const displayLabel = tooltip ? (
Expand Down Expand Up @@ -48,6 +49,12 @@ const FormSelect: React.FC<IFormPropsWithOption> = (props) => {
disabled={disabled}
isInvalid={isInvalid}
feedback={form.errors[field.name]}
onChange={(event) => {
field.onChange(event); // Call Formik's onChange
if (onChange) {
onChange(event); // Call the passed onChange if provided
}
}}
>
{options.map((option) => {
return (
Expand Down
1 change: 1 addition & 0 deletions src/components/Form/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface IFormOption {

export interface IFormPropsWithOption extends IFormProps {
options: IFormOption[];
onChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void;
}

export interface IFormikFieldProps {
Expand Down
11 changes: 10 additions & 1 deletion src/components/Table/GlobalFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@ import DebouncedInput from "./DebouncedInput";
interface FilterProps {
filterValue: string | number;
setFilterValue: (value: string | number) => void;
isDisabled?: boolean; // New optional prop to disable the filter
}

const GlobalFilter: React.FC<FilterProps> = ({ filterValue, setFilterValue }) => {
const GlobalFilter: React.FC<FilterProps> = ({
filterValue,
setFilterValue,
isDisabled = true, // Default to true for disabling
}) => {
const searchHandler = useCallback(
(value: string | number) => setFilterValue(value),
[setFilterValue]
);

if (isDisabled) {
return null; // Render nothing when disabled
}

return (
<DebouncedInput
onChange={searchHandler}
Expand Down
3 changes: 1 addition & 2 deletions src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ const Table: React.FC<TableProps> = ({
)}
</Col>
<span style={{ marginLeft: "5px" }} onClick={toggleGlobalFilter}>
<FaSearch style={{ cursor: "pointer" }} />
{isGlobalFilterVisible ? " Hide" : " Show"}

</span>{" "}
</Row>
</Container>
Expand Down
Loading