diff --git a/snippets/javascript/color-manipulation/rgb-to-hex-color.md b/snippets/javascript/color-manipulation/rgb-to-hex-color.md index 2fdcda9d..ce62b106 100644 --- a/snippets/javascript/color-manipulation/rgb-to-hex-color.md +++ b/snippets/javascript/color-manipulation/rgb-to-hex-color.md @@ -9,10 +9,10 @@ tags: color,conversion function rgbToHex(r, g, b) { const toHex = (n) => { const hex = n.toString(16); - return hex.length === 1 ? '0' + hex : hex; + return hex.length === 1 ? "0" + hex : hex; }; - - return '#' + toHex(r) + toHex(g) + toHex(b); + + return "#" + toHex(r) + toHex(g) + toHex(b); } // Usage: diff --git a/src/components/SnippetModal.tsx b/src/components/SnippetModal.tsx index e91a6ab8..ee5133a1 100644 --- a/src/components/SnippetModal.tsx +++ b/src/components/SnippetModal.tsx @@ -68,7 +68,7 @@ const SnippetModal: React.FC = ({ {snippet.description}

- Contributed by{" "} + Created by{" "} = ({ @{snippet.author}

+ {(snippet.contributors ?? []).length > 0 && ( +
+ Contributors: + {snippet.contributors + ?.slice(0, 3) + .map((contributor, index, slicedArray) => ( + <> + + @{contributor} + + {index < slicedArray.length - 1 && ", "} + + ))} + {(snippet.contributors?.length ?? 0) > 3 && ( + & {snippet.contributors!.length - 3} more + )} +
+ )}