Skip to content

Commit

Permalink
Merge ac109cb into 87fae50
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnasambu committed Oct 4, 2021
2 parents 87fae50 + ac109cb commit 99dc5ed
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions src/apps/concepts/components/ViewConceptsHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ import { getContainerIdFromUrl } from "../utils";
import {
Button,
createStyles,
IconButton,
Input,
InputAdornment,
makeStyles,
Menu,
MenuItem,
TextField,
Theme
} from "@material-ui/core";
import {
PREFERRED_SOURCES_VIEW_ONLY,
useAnchor
} from "../../../utils";
import { APISource } from "../../sources";
import { AccountTreeOutlined, FolderOpen } from "@material-ui/icons";
import { AccountTreeOutlined, FolderOpen } from "@material-ui/icons";
import { Search as SearchIcon } from "@material-ui/icons";
import { APIDictionary } from '../../dictionaries/types';

interface Props {
Expand Down Expand Up @@ -93,6 +96,7 @@ const ViewConceptsHeader: React.FC<Props> = ({
handleSwitchSourceClose
] = useAnchor();

// const [q, setQ] = useState(initialQ);
const getTitleBasedOnContainerType = () => {
return isAddToDictionary
? `Import existing concept from ${getContainerIdFromUrl(containerUrl)}`
Expand Down Expand Up @@ -126,20 +130,23 @@ const ViewConceptsHeader: React.FC<Props> = ({
open={Boolean(switchSourceAnchor)}
onClose={handleSwitchSourceClose}
>
<TextField
multiline
className={classes.textField}
InputProps={{
className: classes.underline
}}
inputProps={{
className: classes.input
}}
value={
showSources ? "Choose a source/dictionary" : "Select a different source/dictionary"
}
onClick={() => setShowSources(!showSources)}
/>
<Input
color="secondary"
type="search"
fullWidth
placeholder= {showSources ? "Select a recommended source" : "Select an alternative source"}
data-testid="searchInput"
endAdornment={
<InputAdornment position="end">
<IconButton
onClick={() => setShowSources(!showSources)}
data-testid="searchButton"
>
<SearchIcon />
</IconButton>
</InputAdornment>
}
/>
{preferredSources?.map(({ name, url }) => (
<MenuItem
// replace because we want to keep the back button useful
Expand Down

0 comments on commit 99dc5ed

Please sign in to comment.