Skip to content

Commit

Permalink
Help text overlays for scene and studio select (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
Flashy78 authored Jul 13, 2023
1 parent ce946af commit 6f95c56
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
11 changes: 11 additions & 0 deletions frontend/src/components/fragments/SearchHint.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import { faCircleQuestion } from "@fortawesome/free-regular-svg-icons";
import { Icon, Tooltip } from "src/components/fragments";

export const SearchHint: React.FC = () => (
<Tooltip text='Add " to the end to include all words, or paste in a Stash ID'>
<div className="SearchHint">
<Icon icon={faCircleQuestion} color="black" />
</div>
</Tooltip>
);
1 change: 1 addition & 0 deletions frontend/src/components/fragments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export { default as ErrorMessage } from "./ErrorMessage";
export { default as Help } from "./Help";
export { default as Tooltip } from "./Tooltip";
export { FavoriteStar } from "./Favorite";
export { SearchHint } from "./SearchHint";
6 changes: 6 additions & 0 deletions frontend/src/components/fragments/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,9 @@
box-shadow: none;
}
}

.SearchHint {
margin-left: 10px;
margin-right: 7px;
cursor: help;
}
8 changes: 7 additions & 1 deletion frontend/src/components/searchField/SearchField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SearchPerformersGQL from "src/graphql/queries/SearchPerformers.gql";
import { SearchAllQuery, SearchPerformersQuery } from "src/graphql";
import { createHref, filterData, getImage } from "src/utils";
import { ROUTE_SEARCH } from "src/constants/route";
import { GenderIcon } from "src/components/fragments";
import { GenderIcon, SearchHint } from "src/components/fragments";

type SceneAllResult = NonNullable<SearchAllQuery["searchScene"][number]>;
type PerformerAllResult = NonNullable<
Expand Down Expand Up @@ -234,6 +234,12 @@ const SearchField: FC<SearchFieldProps> = ({
components={{
DropdownIndicator: () => null,
IndicatorSeparator: () => null,
ValueContainer: ({ children }) => (
<>
<SearchHint />
{children}
</>
),
}}
noOptionsMessage={({ inputValue }) =>
inputValue === "" ? null : `No result found for "${inputValue}"`
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/components/studioSelect/StudioSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { FC } from "react";
import Async from "react-select/async";
import { useApolloClient } from "@apollo/client";
import debounce from "p-debounce";
import { SearchHint } from "src/components/fragments";

import StudiosGQL from "src/graphql/queries/Studios.gql";
import StudioGQL from "src/graphql/queries/Studio.gql";
Expand Down Expand Up @@ -130,6 +131,14 @@ const StudioSelect: FC<StudioSelectProps> = ({
}
isClearable={isClearable}
formatOptionLabel={formatStudioName}
components={{
ValueContainer: ({ children }) => (
<>
<SearchHint />
{children}
</>
),
}}
/>
</div>
);
Expand Down

0 comments on commit 6f95c56

Please sign in to comment.