MCPcopy
hub / github.com/kyechan99/capsule-render / getStyle

Function getStyle

utils/render.ts:6–45  ·  view source on GitHub ↗
(
  section: "footer" | "header",
  fontSize: number = 70,
  descSize: number = 20,
  rotate: number = 0,
  fontFamily: string,
)

Source from the content-addressed store, hash-verified

4import { _, append, appendIf } from "../utils/_";
5
6export const getStyle = (
7 section: "footer" | "header",
8 fontSize: number = 70,
9 descSize: number = 20,
10 rotate: number = 0,
11 fontFamily: string,
12) => {
13 const resolvedFontFamily = fontFamily;
14 return _(
15 html``,
16 append(
17 css(".text", {
18 fontSize: `${fontSize}px`,
19 fontWeight: 700,
20 fontFamily: resolvedFontFamily,
21 }),
22 ),
23 append(
24 css(".desc", {
25 fontSize: `${descSize}px`,
26 fontWeight: 500,
27 fontFamily: resolvedFontFamily,
28 }),
29 ),
30 appendIf(
31 rotate !== 0,
32 css(".text, .desc", {
33 transformOrigin: "center center",
34 transform: `rotate(${rotate}deg)`,
35 }),
36 ),
37 appendIf(
38 section === "footer",
39 css("path", {
40 transform: "rotate(180deg)",
41 transformOrigin: "50% 50%",
42 }),
43 ),
44 );
45};
46
47export const getAnimation = (animation: string) => {
48 if (!animation) return html``;

Callers 1

_drawStyleFunction · 0.90

Calls 5

_Function · 0.90
htmlFunction · 0.90
appendFunction · 0.90
cssFunction · 0.90
appendIfFunction · 0.90

Tested by

no test coverage detected