aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/common/SearchInput.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-09-03 23:09:03 +0800
committerGitHub <noreply@github.com>2020-09-03 23:09:03 +0800
commit1966351eb2046b9edfb3f9ccb50cb8921f1a08dc (patch)
tree792ee4899e7e00d518ea37d6ddd68555a83ac51e /Timeline/ClientApp/src/app/common/SearchInput.tsx
parent3e7e533016b04df4993df66842409cf5857983ee (diff)
parent5a0adf596988efe8c3e49efcba7594f134a9cb0d (diff)
downloadtimeline-1966351eb2046b9edfb3f9ccb50cb8921f1a08dc.tar.gz
timeline-1966351eb2046b9edfb3f9ccb50cb8921f1a08dc.tar.bz2
timeline-1966351eb2046b9edfb3f9ccb50cb8921f1a08dc.zip
Merge pull request #159 from crupest/dev
Development on front end.
Diffstat (limited to 'Timeline/ClientApp/src/app/common/SearchInput.tsx')
-rw-r--r--Timeline/ClientApp/src/app/common/SearchInput.tsx63
1 files changed, 0 insertions, 63 deletions
diff --git a/Timeline/ClientApp/src/app/common/SearchInput.tsx b/Timeline/ClientApp/src/app/common/SearchInput.tsx
deleted file mode 100644
index 5a0b0eaa..00000000
--- a/Timeline/ClientApp/src/app/common/SearchInput.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-import React, { useCallback } from "react";
-import clsx from "clsx";
-import { Spinner, Input, Button } from "reactstrap";
-import { useTranslation } from "react-i18next";
-
-export interface SearchInputProps {
- value: string;
- onChange: (value: string) => void;
- onButtonClick: () => void;
- className?: string;
- loading?: boolean;
- buttonText?: string;
- placeholder?: string;
- additionalButton?: React.ReactNode;
-}
-
-const SearchInput: React.FC<SearchInputProps> = (props) => {
- const { onChange, onButtonClick } = props;
-
- const { t } = useTranslation();
-
- const onInputChange = useCallback(
- (event: React.ChangeEvent<HTMLInputElement>): void => {
- onChange(event.currentTarget.value);
- },
- [onChange]
- );
-
- const onInputKeyPress = useCallback(
- (event: React.KeyboardEvent<HTMLInputElement>): void => {
- if (event.key === "Enter") {
- onButtonClick();
- }
- },
- [onButtonClick]
- );
-
- return (
- <div className={clsx("form-inline my-2", props.className)}>
- <Input
- className="mr-sm-2"
- value={props.value}
- onChange={onInputChange}
- onKeyPress={onInputKeyPress}
- placeholder={props.placeholder}
- />
- <div className="mt-2 mt-sm-0 order-sm-last ml-sm-3">
- {props.additionalButton}
- </div>
- <div className="mt-2 mt-sm-0 ml-auto ml-sm-0">
- {props.loading ? (
- <Spinner />
- ) : (
- <Button outline color="primary" onClick={props.onButtonClick}>
- {props.buttonText ?? t("search")}
- </Button>
- )}
- </div>
- </div>
- );
-};
-
-export default SearchInput;