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

Fixes preview collection button #1350

Merged
merged 8 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 4 additions & 1 deletion src/app/views/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import { telemetry } from '../../../telemetry';
import { translateMessage } from '../../utils/translate-messages';
import History from './history/History';
import SampleQueries from './sample-queries/SampleQueries';

import { ResourceExplorer } from './resource-explorer';
export const Sidebar = () => {
return (
<div>
<Pivot onLinkClick={onPivotItemClick} overflowBehavior='menu'>
<PivotItem headerText={translateMessage('Sample Queries')} itemIcon='Rocket' itemKey='sample-queries'>
<SampleQueries />
</PivotItem>
<PivotItem headerText={translateMessage('Resources')} itemIcon='ExploreData' itemKey='resources'>
<ResourceExplorer />
</PivotItem>
<PivotItem headerText={translateMessage('History')} itemIcon='History' itemKey='history'>
<History />
</PivotItem>
Expand Down
23 changes: 22 additions & 1 deletion src/app/views/sidebar/resource-explorer/CommandOptions.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CommandBar, ICommandBarItemProps } from '@fluentui/react';
import { CommandBar, CommandBarButton, getTheme, IButtonProps, ICommandBarItemProps, ICommandBarStyles,
IContextualMenuItemStyles } from '@fluentui/react';
import React, { useState } from 'react';

import { translateMessage } from '../../../utils/translate-messages';
Expand All @@ -11,6 +12,7 @@ interface ICommandOptions {
const CommandOptions = (props: ICommandOptions) => {
const [isOpen, setIsOpen] = useState(false);
const { version } = props;
const theme = getTheme();
const options: ICommandBarItemProps[] = [
{
key: 'preview',
Expand All @@ -26,13 +28,32 @@ const CommandOptions = (props: ICommandOptions) => {
setIsOpen(open);
}

const itemStyles: Partial<IContextualMenuItemStyles> = {
Onokaev marked this conversation as resolved.
Show resolved Hide resolved
root: {
border: '1px solid',
borderColor: theme.palette.themePrimary,
marginLeft: '-15px'
}
};

const commandBarStyles: Partial<ICommandBarStyles> = {
root: {
backgroundColor: theme.palette.neutralLighter
}
}
const CustomButton: React.FunctionComponent<IButtonProps> = (props_: any) => {
return <CommandBarButton {...props_} onClick={toggleSelectedResourcesPreview} styles={itemStyles}/>;
};

return (
<div>
<CommandBar
items={options}
ariaLabel='Selection actions'
primaryGroupAriaLabel='Selection actions'
farItemsGroupAriaLabel='More selection actions'
buttonAs={CustomButton}
styles={commandBarStyles}
/>
<PathsReview
isOpen={isOpen}
Expand Down