Skip to content

ref(ui): Improve spacing of index search #7493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from '@emotion/styled';

import SentryDocsBot from 'sentry-docs/logos/chatbot.svg';

export function DocsBot() {
export function DocsBotButton() {
return (
<DocsBotLink
href="https://docsbot.ai/chat/skFEy0qDC01GrRrZ7Crs/EPqsd8nu2XmKzWnd45tL"
Expand Down
35 changes: 19 additions & 16 deletions src/components/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import DOMPurify from 'dompurify';
import {Link, navigate} from 'gatsby';
import algoliaInsights from 'search-insights';

import {DocsBot} from 'sentry-docs/components/docsbot';
import {DocsBotButton} from 'sentry-docs/components/docsBotButton';
import {useOnClickOutside} from 'sentry-docs/utils';

import {useKeyboardNavigate} from './hooks/useKeyboardNavigate';
Expand Down Expand Up @@ -155,19 +155,21 @@ export function Search({path, autoFocus, platforms = []}: Props) {
}, []);

return (
<SearchBar ref={ref}>
<input
type="search"
placeholder="Search"
aria-label="Search"
className="form-control search-input"
value={query}
onChange={({target: {value}}) => searchFor(value)}
onFocus={() => setInputFocus(true)}
ref={inputRef}
/>
<Separator>Feeling bold?</Separator>
<DocsBot />
<div ref={ref}>
<SearchBar>
<input
type="search"
placeholder="Search"
aria-label="Search"
className="form-control search-input"
value={query}
onChange={({target: {value}}) => searchFor(value)}
onFocus={() => setInputFocus(true)}
ref={inputRef}
/>
<Separator>Feeling bold?</Separator>
<DocsBotButton />
</SearchBar>
{query.length >= 2 && inputFocus && (
<div className="sgs-search-results">
{loading && <Logo loading />}
Expand Down Expand Up @@ -261,16 +263,17 @@ export function Search({path, autoFocus, platforms = []}: Props) {
)}
</div>
)}
</SearchBar>
</div>
);
}

const SearchBar = styled('div')`
display: flex;
flex-direction: row;
align-items: center;
gap: 1rem;
`;

const Separator = styled('div')`
margin: 6px 8px;
white-space: nowrap;
`;
2 changes: 1 addition & 1 deletion src/css/_includes/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ div.footer-btns {
.index-search {
position: relative;
max-width: 40rem;
margin: 0 auto;
margin: 3rem auto;

.sgs-search-results {
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/css/_includes/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

.sgs-search-results {
position: absolute;
margin-top: 3.5rem;
margin-top: 1rem;
z-index: 5;
border: 0.25rem solid var(--sgs-color-border);
border-radius: 0.5rem;
Expand Down