Skip to content

Commit

Permalink
Add right of search bar prop to top nav (#7500)
Browse files Browse the repository at this point in the history
  • Loading branch information
salazarm committed Apr 20, 2022
1 parent cca4169 commit a34a9e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion js_modules/dagit/packages/core/src/app/AppTopNav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('AppTopNav', () => {
apolloProps={{mocks: [defaultMocks]}}
routerProps={{initialEntries: ['/workspace/my_repository@my_location']}}
>
<AppTopNav searchPlaceholder="Test..." />
<AppTopNav searchPlaceholder="Test..." rightOfSearchBar={<div>RightOfSearchBar</div>} />
</TestProvider>,
);

Expand All @@ -58,6 +58,7 @@ describe('AppTopNav', () => {
expect(runsLink.closest('a')).toHaveAttribute('href', '/instance/runs');
expect(screen.getByText('Assets').closest('a')).toHaveAttribute('href', '/instance/assets');
expect(screen.getByText('Status').closest('a')).toHaveAttribute('href', '/instance');
expect(screen.getByText('RightOfSearchBar')).toBeVisible();
});
});

Expand Down
4 changes: 3 additions & 1 deletion js_modules/dagit/packages/core/src/app/AppTopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ import {WebSocketStatus} from './WebSocketProvider';

interface Props {
searchPlaceholder: string;
rightOfSearchBar?: React.ReactNode;
}

export const AppTopNav: React.FC<Props> = ({children, searchPlaceholder}) => {
export const AppTopNav: React.FC<Props> = ({children, rightOfSearchBar, searchPlaceholder}) => {
const history = useHistory();

return (
<AppTopNavContainer>
<Box flex={{direction: 'row', alignItems: 'center', gap: 16}}>
<AppTopNavLogo />
<SearchDialog searchPlaceholder={searchPlaceholder} />
{rightOfSearchBar}
</Box>
<Box flex={{direction: 'row', alignItems: 'center'}}>
<Box flex={{direction: 'row', alignItems: 'center', gap: 16}}>
Expand Down

0 comments on commit a34a9e6

Please sign in to comment.