Skip to content

Commit

Permalink
Merge branch 'develop' into my_workplans
Browse files Browse the repository at this point in the history
  • Loading branch information
tom0827 committed Dec 12, 2023
2 parents ba8adb4 + 6112910 commit 516b304
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const EnvRegionFilter = () => {
return (
<FilterSelect
options={options}
variant="inline"
variant="inline-standalone"
placeholder="Region"
filterAppliedCallback={(value) => {
if (!value) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const ProjectTypeFilter = () => {
return (
<FilterSelect
options={options}
variant="inline"
variant="inline-standalone"
placeholder="Project Type"
filterAppliedCallback={(value) => {
if (!value) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const TeamFilter = () => {
return (
<FilterSelect
options={options}
variant="inline"
variant="inline-standalone"
placeholder={"Team"}
filterAppliedCallback={(value) => {
if (!value) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const WorkStateFilter = () => {
return (
<FilterSelect
options={options}
variant="inline"
variant="inline-standalone"
placeholder="Work State"
filterAppliedCallback={(value) => {
if (!value) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const WorkTypeFilter = () => {
return (
<FilterSelect
options={options}
variant="inline"
variant="inline-standalone"
placeholder="Work Type"
filterAppliedCallback={(value) => {
if (!value) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const FilterSelect = (props: SelectProps) => {
const [options, setOptions] = React.useState<OptionType[]>([]);
const [selectedOptions, setSelectedOptions] = React.useState<any>();
const [selectValue, setSelectValue] = React.useState<any>(
props.defaultValue || standardDefault
defaultValue ?? standardDefault
);
const [menuIsOpen, setMenuIsOpen] = React.useState<boolean>(
!!props.menuIsOpen
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
import React from "react";
import { MultiValueProps } from "react-select";
import { Box } from "@mui/material";
import { Palette } from "../../../../styles/theme";
import { ETCaption2 } from "../..";

const MultiValue = (props: MultiValueProps) => {
const { filterProps } = props.selectProps;
return (
<>
{props.index === 0 && props.selectProps.value && (
<Box
sx={{
display: "flex",
height: "2.25rem",
// padding: "0px 12px",
alignItems: "center",
alignSelf: "stretch",
borderRadius: "4px",
background: Palette.primary.bg.light,
cursor: "pointer",
maxWidth: "70%",
}}
key={props.index}
>
<ETCaption2
bold
color={Palette.primary.accent.light}
sx={{
overflow: "hidden",
textOverflow: "ellipsis",
}}
>
{filterProps?.variant === "inline"
? "Filtered"
: `${props.selectProps.placeholder}(${
(props.selectProps.value as []).length
})`}
</ETCaption2>
</Box>
)}
{props.index === 0 && !filterProps?.selectedOptions && (
<ETCaption2 color={Palette.neutral.light}>
{props.selectProps.placeholder}
</ETCaption2>
)}
</>
);
};

export default MultiValue;
import React from "react";
import { MultiValueProps } from "react-select";
import { Box } from "@mui/material";
import { Palette } from "../../../../styles/theme";
import { ETCaption2 } from "../..";

const MultiValue = (props: MultiValueProps) => {
const { filterProps } = props.selectProps;
return (
<>
{props.index === 0 && props.selectProps.value && (
<Box
sx={{
display: "flex",
height: "2.25rem",
// padding: "0px 12px",
alignItems: "center",
alignSelf: "stretch",
borderRadius: "4px",
background: Palette.primary.bg.light,
cursor: "pointer",
maxWidth: "70%",
}}
key={props.index}
>
<ETCaption2
bold
color={Palette.primary.accent.light}
sx={{
overflow: "hidden",
textOverflow: "ellipsis",
}}
>
{filterProps?.variant === "inline"
? "Filtered"
: `${props.selectProps.placeholder} (${
(props.selectProps.value as []).length
})`}
</ETCaption2>
</Box>
)}
{props.index === 0 && !filterProps?.selectedOptions && (
<ETCaption2 color={Palette.neutral.light}>
{props.selectProps.placeholder}
</ETCaption2>
)}
</>
);
};

export default MultiValue;
82 changes: 41 additions & 41 deletions epictrack-web/src/components/shared/filterSelect/type.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
import { GroupBase } from "react-select/dist/declarations/src/types";
import { Props } from "react-select";

export interface OptionType {
readonly value: string;
readonly label: string;
}

declare module "react-select/dist/declarations/src/Select" {
export interface Props<
Option,
IsMulti extends boolean,
Group extends GroupBase<Option> = GroupBase<Option>
> {
// Marking as optional here to not raise errors for ControlledSelect
// Make sure to add for FilterSelect
filterProps?: {
applyFilters?: () => void;
clearFilters?: () => void;
selectedOptions: any[];
options?: any[];
onCancel?: () => void;
variant?: "inline" | "bar";
getOptionLabel?: (option: any) => string;
getOptionValue?: (option: any) => string;
label?: string;
};
filterAppliedCallback?: (value?: string[] | string) => void;
filterClearedCallback?: (value?: [] | "") => void;
}
}

export type SelectProps = {
variant: "inline" | "bar";
info?: boolean;
} & Props<OptionType>;

export type TableFilterProps = {
header: any;
column: any;
} & SelectProps;
import { GroupBase } from "react-select/dist/declarations/src/types";
import { Props } from "react-select";

export interface OptionType {
readonly value: string;
readonly label: string;
}

declare module "react-select/dist/declarations/src/Select" {
export interface Props<
Option,
IsMulti extends boolean,
Group extends GroupBase<Option> = GroupBase<Option>
> {
// Marking as optional here to not raise errors for ControlledSelect
// Make sure to add for FilterSelect
filterProps?: {
applyFilters?: () => void;
clearFilters?: () => void;
selectedOptions: any[];
options?: any[];
onCancel?: () => void;
variant?: "inline" | "bar" | "inline-standalone";
getOptionLabel?: (option: any) => string;
getOptionValue?: (option: any) => string;
label?: string;
};
filterAppliedCallback?: (value?: string[] | string) => void;
filterClearedCallback?: (value?: [] | "") => void;
}
}

export type SelectProps = {
variant: "inline" | "bar" | "inline-standalone";
info?: boolean;
} & Props<OptionType>;

export type TableFilterProps = {
header: any;
column: any;
} & SelectProps;

0 comments on commit 516b304

Please sign in to comment.