feat: improvements to custom styles

This commit is contained in:
Amruth Pillai
2026-05-27 22:16:14 +02:00
parent 8461aa65d5
commit c6a654191c
31 changed files with 622 additions and 522 deletions
@@ -210,7 +210,6 @@ const useAzurillTemplate = (): AzurillTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -206,7 +206,6 @@ const useBronzorTemplate = (): BronzorTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -220,7 +220,6 @@ const useChikoritaTemplate = (): ChikoritaTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -248,7 +248,6 @@ const useDitgarTemplate = (): DitgarTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -216,7 +216,6 @@ const useDittoTemplate = (): DittoTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -245,7 +245,6 @@ const useGengarTemplate = (): GengarTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -225,7 +225,6 @@ const useGlalieTemplate = (): GlalieTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -188,7 +188,6 @@ const useKakunaTemplate = (): KakunaTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -190,7 +190,6 @@ const useLaprasTemplate = (): LaprasTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -216,7 +216,6 @@ const useLeafishTemplate = (): LeafishTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -191,7 +191,6 @@ const useMeowthTemplate = (): MeowthTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -186,7 +186,6 @@ const useOnyxTemplate = (): OnyxTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -223,7 +223,6 @@ const usePikachuTemplate = (): PikachuTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -236,7 +236,6 @@ const useRhyhornTemplate = (): RhyhornTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -183,7 +183,6 @@ const useScizorTemplate = (): ScizorTemplate => {
richListItemContent: {
...bodyText,
flex: 1,
lineHeight: metadata.typography.body.lineHeight * 0.5,
},
splitRow: {
flexDirection: r.row,
@@ -0,0 +1,28 @@
import { readdirSync, readFileSync } from "node:fs";
import { basename, join } from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
const templatesDir = fileURLToPath(new URL("../", import.meta.url));
const templatePageFiles = readdirSync(templatesDir, { withFileTypes: true }).flatMap((entry) => {
if (!entry.isDirectory() || entry.name === "shared") return [];
const templateDir = join(templatesDir, entry.name);
const pageFile = readdirSync(templateDir).find((file) => file.endsWith("Page.tsx"));
return pageFile ? [join(templateDir, pageFile)] : [];
});
describe("rich text template styles", () => {
it.each(
templatePageFiles.map((file) => [basename(file), file]),
)("%s keeps list item rich text on the global body line height", (_name, file) => {
const source = readFileSync(file, "utf8");
const richListItemContentBlock = source.match(/richListItemContent:\s*{(?<body>[\s\S]*?)^\s*},/m);
expect(richListItemContentBlock?.groups?.body).toBeDefined();
expect(richListItemContentBlock?.groups?.body).toContain("...bodyText");
expect(richListItemContentBlock?.groups?.body).not.toMatch(/\blineHeight:/);
});
});