| 2 | import { Config, FetchedData } from "./types"; |
| 3 | |
| 4 | export function Root(config: Config, data: FetchedData) { |
| 5 | return new Item("svg", { |
| 6 | id: "root", |
| 7 | attr: { |
| 8 | width: config.width, |
| 9 | height: config.height, |
| 10 | viewBox: `0 0 ${config.width} ${config.height}`, |
| 11 | ...svg_attrs, |
| 12 | }, |
| 13 | style: { fill: "none" }, |
| 14 | children: [ |
| 15 | new Item("title", { |
| 16 | content: `${data?.profile.username || config.username} | LeetCode Stats Card`, |
| 17 | }), |
| 18 | new Item("style", { |
| 19 | id: "default-colors", |
| 20 | content: `svg{opacity:0}:root{--bg-0:#fff;--bg-1:#e5e5e5;--bg-2:#d3d3d3;--bg-3:#d3d3d3;--text-0:#000;--text-1:#808080;--text-2:#808080;--text-3:#808080;--color-0:#ffa116;--color-1:#5cb85c;--color-2:#f0ad4e;--color-3:#d9534f}`, |
| 21 | }), |
| 22 | new Item("rect", { |
| 23 | id: "background", |
| 24 | style: { |
| 25 | transform: "translate(0.5px, 0.5px)", |
| 26 | stroke: "var(--bg-2)", |
| 27 | fill: "var(--bg-0)", |
| 28 | "stroke-width": 1, |
| 29 | width: config.width - 1 + "px", |
| 30 | height: config.height - 1 + "px", |
| 31 | rx: "4px", |
| 32 | }, |
| 33 | }), |
| 34 | ], |
| 35 | }); |
| 36 | } |
| 37 | |
| 38 | export function Icon() { |
| 39 | const item = new Item("g", { |