@@ -4,37 +4,40 @@ import { motion } from 'framer-motion'
44import { removeAppPathPrefix , getVersionsContentInDiff } from '../../../utils'
55import Markdown from '../Markdown'
66
7- const lineColors = {
8- add : '#d6fedb' ,
9- delete : '#fdeff0' ,
10- neutral : '#ffffff' ,
11- }
12-
13- const Container = styled ( ( { isCommentOpen, children, ...props } ) => (
14- < motion . div
15- { ...props }
16- variants = { {
17- open : {
18- height : 'auto' ,
19- } ,
20- hidden : { height : 10 } ,
21- } }
22- initial = { isCommentOpen ? 'open' : 'hidden' }
23- animate = { isCommentOpen ? 'open' : 'hidden' }
24- transition = { {
25- duration : 0.5 ,
26- } }
27- inherit = { false }
28- >
29- < div children = { children } />
30- </ motion . div >
31- ) ) `
7+ const Container = styled ( ( { isCommentOpen, children, ...props } ) => {
8+ return (
9+ < motion . div
10+ { ...props }
11+ variants = { {
12+ open : {
13+ height : 'auto' ,
14+ } ,
15+ hidden : { height : 10 } ,
16+ } }
17+ initial = { isCommentOpen ? 'open' : 'hidden' }
18+ animate = { isCommentOpen ? 'open' : 'hidden' }
19+ transition = { {
20+ duration : 0.5 ,
21+ } }
22+ inherit = { false }
23+ >
24+ < div children = { children } />
25+ </ motion . div >
26+ )
27+ } ) `
3228 overflow: hidden;
3329
3430 & > div {
3531 display: flex;
3632 flex-direction: row;
37- background-color: ${ ( { lineChangeType } ) => lineColors [ lineChangeType ] } ;
33+ background-color: ${ ( { lineChangeType, theme } ) => {
34+ const colorMap = {
35+ add : theme . diff . codeInsertBackground ,
36+ delete : theme . diff . codeDeleteBackground ,
37+ }
38+
39+ return colorMap [ lineChangeType ] || theme . background
40+ } } ;
3841 cursor: pointer;
3942 }
4043`
@@ -43,8 +46,8 @@ const ContentContainer = styled.div`
4346 flex: 1;
4447 position: relative;
4548 padding: 16px;
46- color: #000 ;
47- background-color: #fffbe6;
49+ color: ${ ( { theme } ) => theme . text } ;
50+ background-color: ${ ( { theme } ) => theme . yellowBackground } ;}
4851 user-select: none;
4952`
5053
@@ -67,7 +70,7 @@ const ShowButton = styled(({ isCommentOpen, ...props }) => (
6770 } }
6871 />
6972) ) `
70- background-color: #ffe58f ;
73+ background-color: ${ ( { theme } ) => theme . yellowBorder } ;
7174 margin-left: 20px;
7275 width: 10px;
7376 cursor: pointer;
0 commit comments