Skip to content
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

refactor(style): Improve search bar input focus + styling #8955

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
30 changes: 24 additions & 6 deletions datahub-web-react/src/app/search/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useHistory } from 'react-router';
import { AutoCompleteResultForEntity, EntityType, FacetFilterInput, ScenarioType } from '../../types.generated';
import EntityRegistry from '../entity/EntityRegistry';
import filterSearchQuery from './utils/filterSearchQuery';
import { ANTD_GRAY, ANTD_GRAY_V2 } from '../entity/shared/constants';
import { ANTD_GRAY, ANTD_GRAY_V2, REDESIGN_COLORS } from '../entity/shared/constants';
import { getEntityPath } from '../entity/shared/containers/profile/utils';
import { EXACT_SEARCH_PREFIX } from './utils/constants';
import { useListRecommendationsQuery } from '../../graphql/recommendations.generated';
Expand Down Expand Up @@ -39,13 +39,14 @@ const StyledSearchBar = styled(Input)`
&&& {
border-radius: 70px;
height: 40px;
font-size: 20px;
color: ${ANTD_GRAY[7]};
background-color: ${ANTD_GRAY_V2[2]};
}
> .ant-input {
font-size: 14px;
color: ${ANTD_GRAY[7]};
background-color: ${ANTD_GRAY_V2[2]};
border: 2px solid transparent;

&:focus-within {
border: 1.5px solid ${REDESIGN_COLORS.BLUE};
}
}
> .ant-input::placeholder {
color: ${ANTD_GRAY_V2[10]};
Expand Down Expand Up @@ -296,6 +297,22 @@ export const SearchBar = ({
}
}

const searchInputRef = useRef(null);

useEffect(() => {
const handleKeyDown = (event) => {
// Support command-k to select the search bar.
// 75 is the keyCode for 'k'
if ((event.metaKey || event.ctrlKey) && event.keyCode === 75) {
(searchInputRef?.current as any)?.focus();
}
};
document.addEventListener('keydown', handleKeyDown);
return () => {
document.removeEventListener('keydown', handleKeyDown);
};
}, []);

return (
<AutoCompleteContainer style={style} ref={searchBarWrapperRef}>
<StyledAutoComplete
Expand Down Expand Up @@ -399,6 +416,7 @@ export const SearchBar = ({
/>
</>
}
ref={searchInputRef}
/>
</StyledAutoComplete>
</AutoCompleteContainer>
Expand Down
28 changes: 14 additions & 14 deletions datahub-web-react/src/app/shared/admin/HeaderLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,6 @@ export function HeaderLinks(props: Props) {
</Link>
</LinkWrapper>
)}
{showIngestion && (
<LinkWrapper>
<Link to="/ingestion">
<Button id={HOME_PAGE_INGESTION_ID} type="text">
<Tooltip title="Connect DataHub to your organization's data sources">
<NavTitleContainer>
<ApiOutlined />
<NavTitleText>Ingestion</NavTitleText>
</NavTitleContainer>
</Tooltip>
</Button>
</Link>
</LinkWrapper>
)}
<Dropdown
trigger={['click']}
overlay={
Expand Down Expand Up @@ -145,6 +131,20 @@ export function HeaderLinks(props: Props) {
</Button>
</LinkWrapper>
</Dropdown>
{showIngestion && (
<LinkWrapper>
<Link to="/ingestion">
<Button id={HOME_PAGE_INGESTION_ID} type="text">
<Tooltip title="Connect DataHub to your organization's data sources">
<NavTitleContainer>
<ApiOutlined />
<NavTitleText>Ingestion</NavTitleText>
</NavTitleContainer>
</Tooltip>
</Button>
</Link>
</LinkWrapper>
)}
{showSettings && (
<LinkWrapper style={{ marginRight: 12 }}>
<Link to="/settings">
Expand Down
4 changes: 2 additions & 2 deletions datahub-web-react/src/conf/theme/theme_dark.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"homepageMessage": "Find data you can count(*) on"
},
"search": {
"searchbarMessage": "Search Datasets, People, & more..."
"searchbarMessage": "Search Tables, Dashboards, People, & more..."
},
"menu": {
"items": [
Expand All @@ -52,4 +52,4 @@
]
}
}
}
}
4 changes: 2 additions & 2 deletions datahub-web-react/src/conf/theme/theme_light.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"homepageMessage": "Find data you can count on"
},
"search": {
"searchbarMessage": "Search Datasets, People, & more..."
"searchbarMessage": "Search Tables, Dashboards, People, & more..."
},
"menu": {
"items": [
Expand All @@ -60,4 +60,4 @@
]
}
}
}
}
Loading