Skip to content

Commit

Permalink
remove unused consts
Browse files Browse the repository at this point in the history
  • Loading branch information
seungpark committed Nov 25, 2024
1 parent a005cb7 commit 96598cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.
16 changes: 2 additions & 14 deletions src/components/ActionBar/SearchInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,10 @@ import { isBrowser } from '../../utils/is-browser';
import { localizePath } from '../../utils/locale';
import { reportAnalytics } from '../../utils/report-analytics';
import { searchIconStyling, searchInputStyling, StyledInputContainer, StyledSearchBoxRef } from './styles';
import { ShortcutIcon, SparkleIcon } from './SparkIcon';

export const PLACEHOLDER_TEXT = `Search MongoDB Docs`;
const PLACEHOLDER_TEXT_MOBILE = 'Search';

export const SEARCH_SUGGESTIONS = [
{
copy: 'Search',
},
{
copy: 'Ask MongoDB AI',
icon: <SparkleIcon glyph={'Sparkle'} />,
shortcutIcon: <ShortcutIcon width={30} height={18} />,
},
];

const SearchInput = ({ className, slug }) => {
const [searchValue, setSearchValue] = useState('');
const searchBoxRef = useRef();
Expand Down Expand Up @@ -116,7 +104,7 @@ const SearchInput = ({ className, slug }) => {
<StyledInputContainer className={cx(className)} mobileSearchActive={mobileSearchActive}>
<StyledSearchBoxRef ref={searchBoxRef}>
<LGSearchInput
aria-label="Search MongoDB Docs"
aria-label={PLACEHOLDER_TEXT}
className={searchInputStyling({ mobileSearchActive })}
value={searchValue}
placeholder={isMobile ? PLACEHOLDER_TEXT_MOBILE : PLACEHOLDER_TEXT}
Expand Down Expand Up @@ -148,7 +136,7 @@ const SearchInput = ({ className, slug }) => {
)}
{!mobileSearchActive && (
<IconButton
aria-label="Search MongoDB Docs"
aria-label={PLACEHOLDER_TEXT}
className={searchIconStyling}
onClick={() => {
setMobileSearchActive((state) => !state);
Expand Down
24 changes: 0 additions & 24 deletions src/components/ActionBar/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,30 +253,6 @@ export const searchIconStyling = css`
justify-content: right;
`;

// using content before/after to prevent event bubbling up from lg/search-input/search-result
// package above gets all text inside node, and sets the value of Input node of all text within search result:
// https://github.com/mongodb/leafygreen-ui/blob/%40leafygreen-ui/search-input%402.1.4/packages/search-input/src/SearchInput/SearchInput.tsx#L149-L155
export const suggestionStyling = ({ copy }) => css`
& > div:before {
content: '${copy} "';
}
& > div:after {
content: '"';
}
svg:first-of-type {
float: left;
margin-right: ${theme.size.tiny};
}
padding: ${theme.fontSize.tiny} ${theme.size.medium};
svg:last-of-type {
float: right;
}
`;

export const offlineStyling = css`
@media ${theme.screenSize.largeAndUp} {
display: none;
Expand Down

0 comments on commit 96598cb

Please sign in to comment.