Skip to content

Commit c69b068

Browse files
committed
Refactor code.js to simplify getCustomTokenStyle function
1 parent 539a92b commit c69b068

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/mdx/code.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,14 @@ const CodeBlock = ({children, code, className, style}) => (
9191
</Box>
9292
)
9393

94-
function getCustomTokenStyle(tokenProps) {
95-
const {className, style} = tokenProps
94+
function getCustomTokenStyle({className, style}) {
9695
const colorMap = {
9796
'token comment': '#747458',
9897
'token parameter variable': '#277d7b',
9998
'token function': '#cf3846',
10099
}
101100

102-
return className in colorMap ? {...style, color: colorMap[className]} : style
101+
return colorMap[className] ? {...style, color: colorMap[className]} : style
103102
}
104103

105104
function Code({className = '', prompt, children}) {

0 commit comments

Comments
 (0)