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
9
9
function rgbToHex (r , g , b ) {
10
10
const toHex = (n ) => {
11
11
const hex = n .toString (16 );
12
- return hex .length === 1 ? ' 0 ' + hex : hex;
12
+ return hex .length === 1 ? " 0 " + hex : hex;
13
13
};
14
-
15
- return ' # ' + toHex (r) + toHex (g) + toHex (b);
14
+
15
+ return " # " + toHex (r) + toHex (g) + toHex (b);
16
16
}
17
17
18
18
// Usage:
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ const SnippetModal: React.FC<Props> = ({
68
68
{ snippet . description }
69
69
</ p >
70
70
< p >
71
- Contributed by{ " " }
71
+ Created by{ " " }
72
72
< a
73
73
href = { `https://github.com/${ snippet . author } ` }
74
74
target = "_blank"
@@ -78,6 +78,30 @@ const SnippetModal: React.FC<Props> = ({
78
78
@{ snippet . author }
79
79
</ a >
80
80
</ 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
+ ) }
81
105
< ul role = "list" className = "modal__tags" >
82
106
{ snippet . tags . map ( ( tag ) => (
83
107
< li key = { tag } className = "modal__tag" >
You can’t perform that action at this time.
0 commit comments