yak shaving
This commit is contained in:
parent
61dc53cf32
commit
3763a1f062
2 changed files with 9 additions and 6 deletions
|
@ -16,6 +16,7 @@
|
||||||
h3 { margin: 0; }
|
h3 { margin: 0; }
|
||||||
table { border-spacing: 0; }
|
table { border-spacing: 0; }
|
||||||
|
|
||||||
|
a.cell { text-decoration: none; }
|
||||||
.cell {
|
.cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
@ -34,13 +34,14 @@ let interpColor = {|p|
|
||||||
let viz = { |k, n, cell|
|
let viz = { |k, n, cell|
|
||||||
let ratio = $k / $n
|
let ratio = $k / $n
|
||||||
let percent = $ratio * 100 | math round --precision 1
|
let percent = $ratio * 100 | math round --precision 1
|
||||||
let color = if $n == 0 { "gray" } else { do $interpColor $ratio }
|
let bgColorOpacity = if $k == 0 { 50 } else { 100 }
|
||||||
let textColor = if $k == $n { "gold" } else { "white" }
|
let bgColor = if ($n == 0 or $k == 0) { "gray" } else { $"color-mix\(in srgb, (do $interpColor $ratio) ($bgColorOpacity)%, transparent\)" }
|
||||||
|
let textColor = if $k == $n { "gold" } else if $k == 0 { "lightgray" } else { "white" }
|
||||||
let isExercise = $cell.0.section == "Exercise"
|
let isExercise = $cell.0.section == "Exercise"
|
||||||
let percentStr = $"<small style=\"font-size: 0.7rem\">($percent)%</small>"
|
let percentStr = $"<small style=\"font-size: 0.7rem\">($percent)%</small>"
|
||||||
|
|
||||||
$"<div class=\"cell\" style=\"
|
$"<div class=\"cell\" style=\"
|
||||||
background-color: ($color);
|
background-color: ($bgColor);
|
||||||
color: ($textColor);
|
color: ($textColor);
|
||||||
\">
|
\">
|
||||||
<span>($k) / ($n)</span>
|
<span>($k) / ($n)</span>
|
||||||
|
@ -57,15 +58,16 @@ let vizCh = { |n, table|
|
||||||
let percent = ($ratio * 100 | math round --precision 1)
|
let percent = ($ratio * 100 | math round --precision 1)
|
||||||
let color = if $n == 0 { "gray" } else { do $interpColor $ratio }
|
let color = if $n == 0 { "gray" } else { do $interpColor $ratio }
|
||||||
let textColor = if $completed == $total { "gold" } else { "white" }
|
let textColor = if $completed == $total { "gold" } else { "white" }
|
||||||
|
let url = $"https://git.mzhang.io/school/type-theory/issues/($chapters | get $n)"
|
||||||
|
|
||||||
$"<div data-ch=\"($n)\" class=\"cell\" style=\"
|
$"<a data-ch=\"($n)\" class=\"cell\" style=\"
|
||||||
background-color: ($color);
|
background-color: ($color);
|
||||||
color: ($textColor);
|
color: ($textColor);
|
||||||
\">
|
\" href=\"($url)\" target=\"_blank\">
|
||||||
<h3>($n)</h3>
|
<h3>($n)</h3>
|
||||||
<small>($completed) / ($total)</small>
|
<small>($completed) / ($total)</small>
|
||||||
<small style=\"font-size: 0.5rem;\">($percent)%</small>
|
<small style=\"font-size: 0.5rem;\">($percent)%</small>
|
||||||
</div>" | str replace -a "\n" ""
|
</a>" | str replace -a "\n" ""
|
||||||
}
|
}
|
||||||
|
|
||||||
let vizChapter = { |n|
|
let vizChapter = { |n|
|
||||||
|
|
Loading…
Reference in a new issue