1
1
import Emoji from "react-emoji-render"
2
2
import {
3
3
Avatar ,
4
- ColorMode ,
5
4
Flex ,
6
5
HStack ,
7
6
SimpleGrid ,
8
7
SimpleGridProps ,
9
8
Stack ,
10
9
Text ,
11
- useColorMode ,
12
10
} from "@chakra-ui/react"
13
11
14
12
import type { GHIssue } from "@/lib/types"
15
13
16
- import { getContrastYIQ } from "@/lib/utils/getContrastYIQ"
17
-
18
14
import InlineLink from "../Link"
19
15
import Tag from "../Tag"
20
16
21
17
type IssuesListProps = SimpleGridProps & {
22
18
issues : GHIssue [ ]
23
19
}
24
20
25
- function pickTagColorsByColorMode ( color : string , colorMode : ColorMode ) {
26
- if ( colorMode === "dark" ) {
27
- return {
28
- color : getContrastYIQ ( `#${ color } ` ) ,
29
- bgColor : `#${ color } 90` ,
30
- }
31
- } else {
32
- return {
33
- color : getContrastYIQ ( `#${ color } ` ) ,
34
- bgColor : `#${ color } ` ,
35
- }
36
- }
37
- }
38
-
39
21
const IssuesList = ( { issues, ...props } : IssuesListProps ) => {
40
- const { colorMode } = useColorMode ( )
41
-
42
22
return (
43
23
< SimpleGrid columns = { [ 1 , null , 2 ] } spacing = { 4 } { ...props } >
44
24
{ issues . map ( ( issue ) => (
@@ -58,7 +38,7 @@ const IssuesList = ({ issues, ...props }: IssuesListProps) => {
58
38
w = "32px"
59
39
h = "32px"
60
40
/>
61
- < Text > by { issue . user . login } </ Text >
41
+ < Text size = "sm" > by { issue . user . login } </ Text >
62
42
</ HStack >
63
43
64
44
< InlineLink href = { issue . html_url } textDecor = "none" >
@@ -71,7 +51,7 @@ const IssuesList = ({ issues, ...props }: IssuesListProps) => {
71
51
< Tag
72
52
key = { label . id }
73
53
label = { < Emoji text = { label . name } /> }
74
- { ... pickTagColorsByColorMode ( label . color , colorMode ) }
54
+ variant = "outline"
75
55
/>
76
56
)
77
57
} ) }
0 commit comments