-
Notifications
You must be signed in to change notification settings - Fork 245
feat(sidebar): show header for Data Explorer COMPASS-8904 #6711
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,20 +5,28 @@ import { | |
| css, | ||
| type ItemAction, | ||
| ItemActionControls, | ||
| Badge, | ||
| BadgeVariant, | ||
| } from '@mongodb-js/compass-components'; | ||
|
|
||
| const sidebarHeaderStyles = css({ | ||
| paddingLeft: spacing[400], | ||
| paddingRight: spacing[400], | ||
| display: 'flex', | ||
| justifyContent: 'space-between', | ||
| alignItems: 'center', | ||
| }); | ||
|
|
||
| const sidebarHeaderTextStyles = css({ | ||
| lineHeight: '32px', | ||
| fontWeight: 600, | ||
| }); | ||
|
|
||
| const badgeStyles = css({ | ||
| verticalAlign: 'middle', | ||
| marginLeft: spacing[100], | ||
| }); | ||
|
|
||
| type Action = 'open-compass-settings'; | ||
|
|
||
| const actions: ItemAction<Action>[] = [ | ||
|
|
@@ -31,18 +39,33 @@ const actions: ItemAction<Action>[] = [ | |
|
|
||
| export function SidebarHeader({ | ||
| onAction, | ||
| isCompassWeb, | ||
| }: { | ||
| onAction(actionName: Action): void; | ||
| isCompassWeb?: boolean; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit hesitant about adding a property like that to the component in the same spirit of not making it too easy to differenciate by environment like that as this goes against the architectural goals of the project. I would sugggest to either change the prop to be more aligned with the actual behavior that we want to allow to configure (like making a This is sort of splitting hair, so you tell me if changing this makes sense to you
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. discussed offline, leaving as is for now |
||
| }): React.ReactElement { | ||
| return ( | ||
| <div className={sidebarHeaderStyles} data-testid="sidebar-header"> | ||
| <Subtitle className={sidebarHeaderTextStyles}>Compass</Subtitle> | ||
| <ItemActionControls<Action> | ||
| onAction={onAction} | ||
| iconSize="small" | ||
| actions={actions} | ||
| data-testid="connections-sidebar-title-actions" | ||
| ></ItemActionControls> | ||
| <Subtitle className={sidebarHeaderTextStyles}> | ||
| {isCompassWeb ? 'Data Explorer' : 'Compass'} | ||
| {isCompassWeb && ( | ||
| <Badge | ||
| variant={BadgeVariant.Blue} | ||
| className={badgeStyles} | ||
| data-testid="sidebar-header-badge" | ||
| > | ||
| Preview | ||
| </Badge> | ||
| )} | ||
| </Subtitle> | ||
| {!isCompassWeb && ( | ||
| <ItemActionControls<Action> | ||
| onAction={onAction} | ||
| iconSize="small" | ||
| actions={actions} | ||
| data-testid="connections-sidebar-title-actions" | ||
| ></ItemActionControls> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,8 +202,8 @@ function CompassWorkspace({ | |
| renderSidebar={() => { | ||
| return ( | ||
| <CompassSidebarPlugin | ||
| showSidebarHeader={false} | ||
| onOpenConnectViaModal={onOpenConnectViaModal} | ||
| isCompassWeb={true} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can't figure out why this is giving me type error:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just kidding! running
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, sorry, we didn't touch on that, for context: types are pulled from compiled files, so if you change one package, you need to rebuild it so that you get correct highlight in the other. You can manually rebuild just one package by running something like |
||
| ></CompassSidebarPlugin> | ||
| ); | ||
| }} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept it with justifyContent: 'space-between' because I want to keep the settings icon all the way to the right when it exists, so there's a slight difference between the design in the ticket (badge is closer to the Subtitle) vs how it'll actually be rendered (all the way to the right of the header). Is that okay?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just move the badge inside the subtitle and add some styling to position it to make it aligned with the designs, something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you! Changed now