feat(skin): add captions button to video skins (#612)

This commit is contained in:
Sam Potts
2026-02-26 11:09:22 +11:00
committed by GitHub
parent cb09079758
commit fbf888fda3
13 changed files with 195 additions and 14 deletions
+8 -8
View File
@@ -25,19 +25,16 @@ const SVGO_CONFIG: Config = {
params: {
overrides: {
removeViewBox: false,
convertColors: {
currentColor: /^black$/,
},
},
},
},
{
name: 'removeAttrs',
params: {
attrs: ['^fill$', '^stroke$', '^clip-rule$', '^fill-rule$'],
},
},
{
name: 'addAttributesToSVGElement',
params: {
attributes: [{ fill: 'currentColor' }],
attrs: ['^clip-rule$', '^fill-rule$'],
},
},
],
@@ -64,7 +61,10 @@ function getSvgFiles(setName: string): string[] {
}
function optimizeSvg(svgContent: string): string {
return optimize(svgContent, SVGO_CONFIG).data;
const optimized = optimize(svgContent, SVGO_CONFIG).data;
return optimized
.replaceAll('fill="black"', 'fill="currentColor"')
.replaceAll('stroke="black"', 'stroke="currentColor"');
}
async function buildReactComponent(svgContent: string, componentName: string): Promise<{ js: string; tsx: string }> {