fix: readded gap between x-ray preview comment icons. (#1915)

* fix: readded gap between x-ray preview comment icons.

* feat: keep size 400px

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
This commit is contained in:
Jakob Guddas
2024-03-06 21:00:26 +01:00
committed by GitHub
parent d67ef7b0ca
commit d255c6ac4e

View File

@@ -14,8 +14,7 @@ const changedFiles = changedFilesPathString
.filter((file, idx, arr) => arr.indexOf(file) === idx);
const getImageTagsByFiles = (files, getBaseUrl, width) =>
files
.map((file) => {
files.map((file) => {
const svgContent = fs.readFileSync(path.join(process.cwd(), file), 'utf-8');
const strippedAttrsSVG = svgContent.replace(/<svg[^>]*>/, '<svg>');
const minifiedSvg = minifySvg(strippedAttrsSVG);
@@ -25,8 +24,7 @@ const getImageTagsByFiles = (files, getBaseUrl, width) =>
const widthAttr = width ? `width="${width}"` : '';
return `<img title="${file}" alt="${file}" ${widthAttr} src="${url}/${base64}.svg"/>`;
})
.join('');
});
const svgFiles = readSvgDirectory(ICONS_DIR).map((file) => `icons/${file}`);
@@ -35,29 +33,32 @@ const iconsFilteredByName = (search) => svgFiles.filter((file) => file.includes(
const cohesionRandomImageTags = getImageTagsByFiles(
shuffle(svgFiles).slice(0, changedFiles.length),
() => `${BASE_URL}/stroke-width/2`,
);
).join('');
const cohesionSquaresImageTags = getImageTagsByFiles(
shuffle(iconsFilteredByName('square')).slice(0, changedFiles.length),
() => `${BASE_URL}/stroke-width/2`,
);
).join('');
const changeFiles1pxStrokeImageTags = getImageTagsByFiles(
changedFiles,
() => `${BASE_URL}/stroke-width/1`,
);
).join('');
const changeFiles2pxStrokeImageTags = getImageTagsByFiles(
changedFiles,
() => `${BASE_URL}/stroke-width/2`,
);
).join('');
const changeFiles3pxStrokeImageTags = getImageTagsByFiles(
changedFiles,
() => `${BASE_URL}/stroke-width/3`,
);
).join('');
const changeFilesLowDPIImageTags = getImageTagsByFiles(changedFiles, () => `${BASE_URL}/dpi/24`);
const changeFilesLowDPIImageTags = getImageTagsByFiles(
changedFiles,
() => `${BASE_URL}/dpi/24`,
).join(' ');
const changeFilesXRayImageTags = getImageTagsByFiles(
changedFiles,
@@ -67,7 +68,7 @@ const changeFilesXRayImageTags = getImageTagsByFiles(
return `${BASE_URL}/${iconName}`;
},
400,
);
).join(' ');
const commentMarkup = `\
### Added or changed icons