File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed
snippets/javascript/color-manipulation Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,10 @@ tags: color,conversion
99function rgbToHex (r , g , b ) {
1010 const toHex = (n ) => {
1111 const hex = n .toString (16 );
12- return hex .length === 1 ? ' 0 ' + hex : hex;
12+ return hex .length === 1 ? " 0 " + hex : hex;
1313 };
14-
15- return ' # ' + toHex (r) + toHex (g) + toHex (b);
14+
15+ return " # " + toHex (r) + toHex (g) + toHex (b);
1616}
1717
1818// Usage:
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ const SnippetModal: React.FC<Props> = ({
6868 { snippet . description }
6969 </ p >
7070 < p >
71- Contributed by{ " " }
71+ Created by{ " " }
7272 < a
7373 href = { `https://github.com/${ snippet . author } ` }
7474 target = "_blank"
@@ -78,6 +78,30 @@ const SnippetModal: React.FC<Props> = ({
7878 @{ snippet . author }
7979 </ a >
8080 </ p >
81+ { ( snippet . contributors ?? [ ] ) . length > 0 && (
82+ < div className = "contributors" >
83+ < span > Contributors: </ span >
84+ { snippet . contributors
85+ ?. slice ( 0 , 3 )
86+ . map ( ( contributor , index , slicedArray ) => (
87+ < >
88+ < a
89+ key = { contributor }
90+ href = { `https://github.com/${ contributor } ` }
91+ target = "_blank"
92+ rel = "noopener noreferrer"
93+ className = "styled-link"
94+ >
95+ @{ contributor }
96+ </ a >
97+ { index < slicedArray . length - 1 && ", " }
98+ </ >
99+ ) ) }
100+ { ( snippet . contributors ?. length ?? 0 ) > 3 && (
101+ < span > & { snippet . contributors ! . length - 3 } more</ span >
102+ ) }
103+ </ div >
104+ ) }
81105 < ul role = "list" className = "modal__tags" >
82106 { snippet . tags . map ( ( tag ) => (
83107 < li key = { tag } className = "modal__tag" >
You can’t perform that action at this time.
0 commit comments