mirror of
https://github.com/tiennm99/ghglance.git
synced 2026-10-11 03:13:20 +00:00
refactor(card): shrink cards from 500x220 to 340x200
Two ghstats cards side-by-side at 500px overflow GitHub's README column
width (~816px). Matching github-profile-summary-cards' 340x200 lets
consumers place two cards per row cleanly.
- Shared header() rect corner radius 8→6, title font 18→15, title anchor
(25,35)→(20,30).
- All card layouts reworked:
* profile + stats: row padding 70→55 / 24→20, icon 14→12, value
font 13→12, stats right-anchor x=475→320.
* donut_chart: centre (380,120)→(250,110), outerR 70→55, innerR 38→30,
legend y0 70→55, swatch 12→10, topN 6→5.
* productive-time: leftAxis 50→35, topPad 60→45, barGap 2→1.
* contributions: leftPad/rightPad 35→28, topPad 60→45, chartH 120→105.
Visual parity with github-profile-summary-cards; two-per-row layouts in
profile READMEs now fit.
Also: document the one-time GitHub Marketplace publishing step in
deployment-guide (no CLI flag exists — UI checkbox only).
This commit is contained in:
1 parent
8cc31d3d97
commit
ce70dcf87c
7 files changed
+51
-46
No files matched your search
@@ -14,17 +14,17 @@ import (
|
||||
// shown; smaller slices are grouped into "Other".
|
||||
func renderDonutCard(title string, stats []github.LangStat, t theme.Theme) []byte {
|
||||
const (
|
||||
width = 500
|
||||
height = 220
|
||||
topN = 6
|
||||
cx = 380 // donut centre x
|
||||
cy = 120 // donut centre y
|
||||
outerR = 70.0 // donut outer radius
|
||||
innerR = 38.0 // donut hole
|
||||
legendX = 30
|
||||
legendY0 = 70
|
||||
legendDY = 22
|
||||
swatchSz = 12
|
||||
width = 340
|
||||
height = 200
|
||||
topN = 5
|
||||
cx = 250 // donut centre x
|
||||
cy = 110 // donut centre y
|
||||
outerR = 55.0 // donut outer radius
|
||||
innerR = 30.0 // donut hole
|
||||
legendX = 20
|
||||
legendY0 = 55
|
||||
legendDY = 20
|
||||
swatchSz = 10
|
||||
)
|
||||
|
||||
stats = collapseOther(stats, topN)
|
||||
@@ -50,10 +50,10 @@ func renderDonutCard(title string, stats []github.LangStat, t theme.Theme) []byt
|
||||
y := legendY0 + i*legendDY
|
||||
fmt.Fprintf(&b, `
|
||||
<rect x="%d" y="%d" width="%d" height="%d" fill="%s" stroke="%s" stroke-width="1"/>
|
||||
<text x="%d" y="%d" font-size="13" fill="%s">%s %.2f%%</text>`,
|
||||
<text x="%d" y="%d" font-size="11" fill="%s">%s %.2f%%</text>`,
|
||||
legendX, y-swatchSz+2, swatchSz, swatchSz,
|
||||
colorOrAccent(s.Color, t.Accent), t.Background,
|
||||
legendX+swatchSz+8, y, t.Text,
|
||||
legendX+swatchSz+6, y, t.Text,
|
||||
escapeXML(s.Name), pct)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user