Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components/Insights/InsightsCatalog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ export const InsightsCatalog = (props: InsightsCatalogProps) => {
);
const config = useContext(ConfigContext);
const previousConfig = usePrevious(config);
const previousScope = usePrevious(config.scope?.span);

useEffect(() => {
if (!previousScope || previousScope !== config.scope?.span) {
setSearchInputValue("");
}
}, [config.scope, previousScope]);

useEffect(() => {
if (
Expand Down Expand Up @@ -76,6 +83,7 @@ export const InsightsCatalog = (props: InsightsCatalogProps) => {
<>
<s.Toolbar>
<SearchInput
disabled={!!config.scope?.span}
onChange={(val: string | null) => {
setSearchInputValue(val);
}}
Expand Down
2 changes: 2 additions & 0 deletions src/components/common/SearchInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ export const SearchInput = (props: SearchInputProps) => {
<MagnifierIcon color={"currentColor"} size={14} />
</s.SearchInputIconContainer>
<s.SearchInput
disabled={props.disabled}
placeholder={"Search"}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
props.onChange(e.target.value)
}
value={props.value || ""}
/>
<s.DeleteTagButton
disabled={props.disabled}
onClick={() => {
props.onChange("");
}}
Expand Down
10 changes: 10 additions & 0 deletions src/components/common/SearchInput/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ export const SearchInput = styled.input`
}
}};

&:disabled {
border: 1px solid;
background: ${grayScale[700]};
pointer-events: none;
}

&:focus,
&:hover {
border: 1px solid
Expand Down Expand Up @@ -91,4 +97,8 @@ export const DeleteTagButton = styled.button`
top: 0;
bottom: 0;
color: ${({ theme }) => theme.colors.icon.disabledAlt};

&:disabled {
pointer-events: none;
}
`;
1 change: 1 addition & 0 deletions src/components/common/SearchInput/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface SearchInputProps {
onChange: (value: string | null) => void;
value?: string | null;
disabled?: boolean;
}