Skip to content

Commit

Permalink
Fix: Default overlay on collections review panel (#2377)
Browse files Browse the repository at this point in the history
  • Loading branch information
Onokaev authored Feb 7, 2023
1 parent 870276a commit bd5da68
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const AdaptiveCard = (props: any) => {
if(!child){ return; }
if(child && child.tagName === 'BUTTON'){ return; }

child.style.color = currentTheme.palette.whiteTranslucent40;
child.style.color = currentTheme.palette.black;
if (child.children.length > 0) {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < child.children.length; i++) {
Expand Down
13 changes: 11 additions & 2 deletions src/app/views/query-runner/request/permissions/PanelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const PanelList = ({ messages,
}

const { consentedScopes, scopes, authToken,
permissionsPanelOpen } = useAppSelector((state) => state);
permissionsPanelOpen, theme: appTheme } = useAppSelector((state) => state);
const { fullPermissions } = scopes.data;
const [permissions, setPermissions] = useState<any []>([]);
const [groups, setGroups] = useState<IGroup[]>([]);
Expand Down Expand Up @@ -117,8 +117,17 @@ const PanelList = ({ messages,
});
};

const isCurrentThemeDark = (): boolean => {
return (appTheme === 'dark' || appTheme === 'high-contrast');
}

const panelOverlayProps: IOverlayProps = {
isDarkThemed: true
styles: {
root: {
backgroundColor: isCurrentThemeDark() ? theme.palette.blackTranslucent40 :
theme.palette.whiteTranslucent40
}
}
}

const displayLoadingPermissionsText = () => {
Expand Down
19 changes: 17 additions & 2 deletions src/app/views/sidebar/resource-explorer/panels/PathsReview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
CommandBar, ICommandBarItemProps, Label, Panel, PanelType, PrimaryButton
CommandBar, getTheme, ICommandBarItemProps, IOverlayProps, Label, Panel, PanelType, PrimaryButton
} from '@fluentui/react';
import { useState } from 'react';
import { FormattedMessage } from 'react-intl';
Expand All @@ -21,12 +21,13 @@ export interface IPathsReview {

const PathsReview = (props: IPathsReview) => {
const dispatch: AppDispatch = useDispatch();
const { resources: { paths: items } } = useAppSelector(
const { resources: { paths: items }, theme } = useAppSelector(
(state) => state
);
const { isOpen } = props;
const headerText = translateMessage('Selected Resources') + ' ' + translateMessage('Preview');
const [selectedItems, setSelectedItems] = useState<IResourceLink[]>([]);
const currentTheme = getTheme();

const columns = [
{ key: 'url', name: 'URL', fieldName: 'url', minWidth: 300, maxWidth: 350, isResizable: true }
Expand Down Expand Up @@ -67,6 +68,19 @@ const PathsReview = (props: IPathsReview) => {
setSelectedItems(content);
};

const isCurrentThemeDark = (): boolean => {
return (theme === 'dark' || theme === 'high-contrast');
}

const panelOverlayProps: IOverlayProps = {
styles: {
root: {
backgroundColor: isCurrentThemeDark() ? currentTheme.palette.blackTranslucent40 :
currentTheme.palette.whiteTranslucent40
}
}
}

return (
<>
<Panel
Expand All @@ -76,6 +90,7 @@ const PathsReview = (props: IPathsReview) => {
type={PanelType.large}
onRenderFooterContent={renderFooterContent}
closeButtonAriaLabel='Close'
overlayProps={panelOverlayProps}
>
<Label>
<FormattedMessage id='Export list as a Postman collection message' />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/themes/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export const dark = {
black: '#ffffff',
white: '#070707',
blueMid: '#6cb8f6',
green: '#00a100',
whiteTranslucent40: '#ffffff'
green: '#00a100'
},
semanticColors: {
messageText: '#f3f2f1',
Expand Down
4 changes: 2 additions & 2 deletions src/themes/high-contrast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const highContrast = {
black: '#f8f8f8',
white: '#000000',
blueMid: '#6cb8f6',
green: '#92c353',
whiteTranslucent40: '#ffffff'
green: '#92c353'

},
semanticColors: {
messageText: '#f4f4f4',
Expand Down
3 changes: 1 addition & 2 deletions src/themes/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const light = {
black: '#1d1d1d',
white: '#ffffff',
blueMid: '#00188F',
green: '#008000',
whiteTranslucent40: '#ffffff'
green: '#008000'
}
};

0 comments on commit bd5da68

Please sign in to comment.