Skip to content

Commit

Permalink
refactor: unify-css-for-code (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawkyZ authored Nov 22, 2024
1 parent 0a3e55d commit 52b807d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 111 deletions.
38 changes: 1 addition & 37 deletions Snyk.VisualStudio.Extension.2022/UI/Html/BaseHtmlProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,7 @@ public class BaseHtmlProvider : IHtmlProvider
{
public virtual string GetCss()
{
return @"
html, body {
height: 100%;
display: flex;
flex-direction: column;
margin: 0;
padding: 0;
}
body {
background-color: var(--background-color);
color: var(--text-color);
font-weight: 400;
}
section {
padding: 20px;
}
.font-light {
font-weight: bold;
}
a,
.link {
color: var(--link-color);
}
.delimiter-top {
border-top: 1px solid var(--horizontal-border-color);
}
code {
background-color: var(--code-background-color);
padding: 1px 3px;
border-radius: 4px;
}
";
return "";
}

public virtual string GetJs()
Expand Down
76 changes: 2 additions & 74 deletions Snyk.VisualStudio.Extension.2022/UI/Html/CodeHtmlProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,78 +21,6 @@ public static CodeHtmlProvider Instance
}
}

public override string GetCss()
{
return base.GetCss() + Environment.NewLine + @"
.identifiers {
padding-bottom: 20px;
}
.data-flow-table {
background-color: var(--code-background-color);
border: 1px solid transparent;
}
.tabs-nav {
margin: 21px 0 -21px;
}
.light .dark-only,
.high-contrast.high-contrast-light .dark-only {
display: none;
}
.dark .light-only,
.high-contrast:not(.high-contrast-light) .light-only {
display: none;
}
.tab-item {
cursor: pointer;
display: inline-block;
padding: 5px 10px;
border-bottom: 1px solid transparent;
color: var(--text-color);
text-transform: uppercase;
}
.tab-item:hover {
}
.tab-item.is-selected {
border-bottom: 3px solid var(--link-color);
}
.tab-content {
display: none;
}
.tab-content.is-selected {
display: block;
}
.removed {
background-color: var(--line-removed);
color: #fff;
}
.lesson-link {
margin-left: 3px;
}
.added {
background-color: var(--line-added);
color: #fff;
}
.arrow {
cursor: pointer;
width: 20px;
height: 20px;
padding: 4px;
border-radius: 4px;
text-align: center;
line-height: 1;
}
.example {
background-color: var(--container-background-color);
}
";
}

public override string GetInitScript()
{
var themeScript = GetThemeScript();
Expand Down Expand Up @@ -147,8 +75,8 @@ public override string ReplaceCssVariables(string html)
{
html = base.ReplaceCssVariables(html);

html = html.Replace("var(--line-removed)", VSColorTheme.GetThemedColor(EnvironmentColors.VizSurfaceRedDarkBrushKey).ToHex());
html = html.Replace("var(--line-added)", VSColorTheme.GetThemedColor(EnvironmentColors.VizSurfaceGreenDarkBrushKey).ToHex());
html = html.Replace("var(--example-line-removed-color)", VSColorTheme.GetThemedColor(EnvironmentColors.VizSurfaceRedDarkBrushKey).ToHex());
html = html.Replace("var(--example-line-added-color)", VSColorTheme.GetThemedColor(EnvironmentColors.VizSurfaceGreenDarkBrushKey).ToHex());

return html;
}
Expand Down

0 comments on commit 52b807d

Please sign in to comment.