1
1
import { Box , StyledOcticon , Text } from '@primer/react'
2
- import { CheckCircleFillIcon , XCircleFillIcon } from '@primer/octicons-react'
3
2
import React from 'react'
4
3
5
4
export function DoDontContainer ( { stacked, children} ) {
@@ -15,22 +14,48 @@ DoDontContainer.defaultProps = {
15
14
}
16
15
17
16
export function Do ( props ) {
18
- return < DoDontBase { ...props } title = "Do" icon = { CheckCircleFillIcon } iconBg = "success.fg " />
17
+ return < DoDontBase { ...props } title = "Do" bg = "success.fg" borderColor = "success.muted " />
19
18
}
20
19
21
20
export function Dont ( props ) {
22
- return < DoDontBase { ...props } title = "Don' t" icon = { XCircleFillIcon } iconBg = "danger.fg " />
21
+ return < DoDontBase { ...props } title = "Don’ t" bg = "danger.fg" borderColor = "danger.muted " />
23
22
}
24
23
25
- function DoDontBase ( { children, title, icon : Icon , iconBg } ) {
24
+ function DoDontBase ( { children, title, bg , borderColor , indented } ) {
26
25
return (
27
26
< Box sx = { { display : 'flex' , flexDirection : 'column' } } >
28
- < Box sx = { { display : 'flex' , alignSelf : 'start' , flexDirection : 'row' , alignItems : 'center' , mb : '2' } } >
29
- < StyledOcticon icon = { Icon } sx = { { color : iconBg } } />
30
- < Text sx = { { fontWeight : 'bold' , color : 'fg.default' , ml : 2 } } > { title } </ Text >
27
+ < Box
28
+ sx = { {
29
+ display : 'flex' ,
30
+ alignSelf : 'start' ,
31
+ flexDirection : 'row' ,
32
+ alignItems : 'center' ,
33
+ mb : '2' ,
34
+ backgroundColor : bg ,
35
+ borderRadius : '2' ,
36
+ color : 'fg.onEmphasis' ,
37
+ paddingX : '2'
38
+ } }
39
+ >
40
+ < Text sx = { { fontWeight : 'bold' , fontSize : '1' , color : 'fg.onEmphasis' } } > { title } </ Text >
31
41
</ Box >
32
42
< Box sx = { { '& *:last-child' : { mb : 0 } , img : { maxWidth : '100%' } , display : 'flex' , flexDirection : 'column' } } >
33
- { children }
43
+ { indented ? (
44
+ < Box
45
+ as = "blockquote"
46
+ sx = { {
47
+ margin : '0' ,
48
+ borderLeftWidth : '4px' ,
49
+ borderLeftStyle : 'solid' ,
50
+ borderLeftColor : borderColor ,
51
+ paddingLeft : '3'
52
+ } }
53
+ >
54
+ { children }
55
+ </ Box >
56
+ ) : (
57
+ children
58
+ ) }
34
59
</ Box >
35
60
</ Box >
36
61
)
0 commit comments