Skip to content

Commit

Permalink
fix: improve minimap color theme & problem color theme (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalYoung authored and ProfBramble committed Aug 4, 2021
1 parent 8529503 commit c616479
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 25 deletions.
5 changes: 0 additions & 5 deletions src/components/collapse/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,8 @@ $collapse__extra: #{$collapse}__extra;
opacity: 0;

#{$actionBar}__label.codicon {
color: var(--activityBar-inactiveForeground);
height: inherit;
line-height: inherit;

&:hover {
color: var(--activityBar-activeBorder);
}
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/components/tree/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ $switch: #{$rcTree}-switcher;
margin: 0;
padding: 0 0 0 18px;
}

span#{$switch} {
background-attachment: scroll;
background-color: transparent;
Expand Down Expand Up @@ -65,11 +66,6 @@ $switch: #{$rcTree}-switcher;
cursor: not-allowed;
}
}

&-selected {
background: var(--list-activeSelectionBackground);
border-color: var(--list-focusOutline);
}
}

&-node-content-wrapper {
Expand Down
6 changes: 6 additions & 0 deletions src/extensions/theme-defaults/themes/dark_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@
"inputValidation.errorBackground": "#5A1D1D",
"inputValidation.errorBorder": "#BE1100",
"icon.foreground": "#C5C5C5",
"problemsWarningIcon.foreground": "#CCA700",
"problemsErrorIcon.foreground": "#F48771",
"problemsInfoIcon.foreground": "#75BEFF",
"settings.textInputBackground": "#292929",
"settings.numberInputBackground": "#292929",
"menu.background": "#252526",
"menu.foreground": "#CCCCCC",
"menu.selectionBackground": "#094771",
"menu.separatorBackground": "#BBBBBB",
"minimapSlider.background": "#79797980",
"minimapSlider.hoverBackground": "#64646480",
"minimapSlider.activeBackground": "#bfbfbf66",
"statusBarItem.remoteForeground": "#FFF",
"statusBarItem.remoteBackground": "#16825D",
"sidebarSectionHeader.background": "#0000",
Expand Down
6 changes: 6 additions & 0 deletions src/extensions/theme-defaults/themes/light_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"inputValidation.errorBackground": "#F2DEDE",
"inputValidation.errorBorder": "#BE1100",
"icon.foreground": "#424242",
"problemsWarningIcon.foreground": "#BF8803",
"problemsErrorIcon.foreground": "#E51400",
"problemsInfoIcon.foreground": "#75BEFF",
"searchEditor.textInputBorder": "#CECECE",
"diffEditor.insertedTextBackground": "#9bb95533",
"diffEditor.removedTextBackground": "#ff000033",
Expand All @@ -39,6 +42,9 @@
"tab.border": "#f3f3f3",
"menu.selectionBackground": "#0060C0",
"menu.separatorBackground": "#888888",
"minimapSlider.background": "#64646480",
"minimapSlider.hoverBackground": "#64646480",
"minimapSlider.activeBackground": "#00000099",
"tab.inactiveBackground": "rgb(236, 236, 236)",
"tab.inactiveForeground": "rgba(51, 51, 51, 0.7)",
"tab.activeBackground": "#fffffe",
Expand Down
7 changes: 6 additions & 1 deletion src/style/theme/tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@
}

.rc-tree-treenode-selected {
background: var(--button-background);
background: var(--list-activeSelectionBackground);
border-color: var(--list-focusOutline);

.rc-tree-node-content-wrapper {
color: var(--list-activeSelectionForeground);
}

.rc-tree-switcher {
color: var(--list-activeSelectionForeground);
}
}

input {
Expand Down
4 changes: 0 additions & 4 deletions src/workbench/editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
justify-content: center;
padding: 0 8px 0 4px;

&:not(#{$editor}__group-actions-item--disabled):hover {
color: var(--activityBar-activeBorder);
}

&--disabled {
cursor: default;
opacity: 0.4;
Expand Down
28 changes: 24 additions & 4 deletions src/workbench/problems/paneView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as React from 'react';
import { getBEMElement, prefixClaName } from 'mo/common/className';
import TreeView from 'mo/components/tree';
import { localize } from 'mo/i18n/localize';
import { Scrollable } from 'mo/components';
import { Icon, Scrollable } from 'mo/components';
import { IProblems, MarkerSeverity } from 'mo/model';

const defaultClassName = prefixClaName('problems');
const treeClassName = getBEMElement(defaultClassName, 'treeview');
Expand All @@ -11,9 +12,9 @@ const treeNodeBadgeClassName = getBEMElement(treeNodeClassName, 'badge');
const treeLeafClassName = getBEMElement(treeClassName, 'treeLeaf');
const treeLeafSubInfoClassName = getBEMElement(treeLeafClassName, 'subInfo');

function ProblemsPaneView(props: any) {
function ProblemsPaneView(props: IProblems) {
const { data } = props;
if (!data?.length)
if (!data?.length) {
return (
<div style={{ margin: '0 18px', userSelect: 'none' }}>
{localize(
Expand All @@ -22,6 +23,24 @@ function ProblemsPaneView(props: any) {
)}
</div>
);
}

const getIcon = (status: number) => {
switch (status) {
case MarkerSeverity.Error: {
return <Icon type="error" />;
}
case MarkerSeverity.Warning: {
return <Icon type="warning" />;
}
case MarkerSeverity.Info: {
return <Icon type="info" />;
}
default: {
return '';
}
}
};

return (
<Scrollable>
Expand All @@ -39,7 +58,8 @@ function ProblemsPaneView(props: any) {
</span>
) : (
<span className={treeLeafClassName}>
{value.message}
{getIcon(value.status)}
<span>{value.message}</span>
<span className={treeLeafSubInfoClassName}>
{value.code}
</span>
Expand Down
37 changes: 31 additions & 6 deletions src/workbench/problems/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import 'mo/style/common';

$badge-size: 18px;
$badge-size: 11px;

#{$problems} {
margin: 0 18px;
Expand All @@ -12,21 +12,46 @@ $badge-size: 18px;

&__badge {
background: var(--badge-background);
border-radius: 50%;
border-radius: $badge-size;
box-sizing: border-box;
color: var(--badge-foreground);
display: inline-block;
height: $badge-size;
font-size: $badge-size;
font-weight: 400;
line-height: $badge-size;
margin-left: 10px;
min-height: 18px;
min-width: 18px;
padding: 3px 6px;
text-align: center;
width: $badge-size;
}
}

#{$rcTree}-treenode:not(#{$rcTree}-treenode-selected) {
.codicon-info {
color: var(--problemsInfoIcon-foreground);
}

.codicon-warning {
color: var(--problemsWarningIcon-foreground);
}

.codicon-error {
color: var(--problemsErrorIcon-foreground);
}
}

&__treeLeaf {
align-items: center;
display: flex;

.codicon {
margin-right: 6px;
}

&__subInfo {
color: var(--activityBar-inactiveForeground);
margin-left: 5px;
margin-left: 6px;
opacity: 0.7;
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions stories/extensions/problems/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,34 @@ function init() {
startColumn: 1,
endLineNumber: 0,
endColumn: 1,
status: 8,
},
children: [],
},
{
id: 4,
name: '0-1',
value: {
code: 'endLineNumber',
message: '解析可能会存在问题',
startLineNumber: 0,
startColumn: 1,
endLineNumber: 0,
endColumn: 1,
status: 4,
},
children: [],
},
{
id: 5,
name: '0-1',
value: {
code: 'endLineNumber',
message: '住在山里,真不戳',
startLineNumber: 0,
startColumn: 1,
endLineNumber: 0,
endColumn: 1,
status: 2,
},
children: [],
Expand Down

0 comments on commit c616479

Please sign in to comment.