-
Notifications
You must be signed in to change notification settings - Fork 342
/
ConfirmDialog.tsx
94 lines (86 loc) · 2.61 KB
/
ConfirmDialog.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import React from 'react'
import styled from 'styled-components'
import { SecondaryAction } from 'src/common-ui/components/design-library/actions/SecondaryAction'
import { PrimaryAction } from '@worldbrain/memex-common/lib/common-ui/components/PrimaryAction'
export interface Props {
titleText: React.ReactChild
subTitleText?: React.ReactChild
negativeLabel?: React.ReactChild
affirmativeLabel?: React.ReactChild
handleConfirmation: (affirmative: boolean) => React.MouseEventHandler
}
export default class ConfirmDialog extends React.PureComponent<Props> {
render() {
const {
titleText,
handleConfirmation,
affirmativeLabel,
negativeLabel,
subTitleText,
} = this.props
return (
<Container>
<TextContainer>
<TitleText>{titleText}</TitleText>
<SubTitleText>{subTitleText}</SubTitleText>
</TextContainer>
<ConfirmBtnRow>
<PrimaryAction
label={negativeLabel ?? 'No'}
onClick={handleConfirmation(false)}
type={'primary'}
size={'medium'}
width={'210px'}
icon={'check'}
/>
<PrimaryAction
label={affirmativeLabel ?? 'Yes'}
onClick={handleConfirmation(true)}
type={'forth'}
size={'medium'}
width={'210px'}
icon={'removeX'}
/>
</ConfirmBtnRow>
</Container>
)
}
}
const TextContainer = styled.div`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
grid-gap: 10px;
`
const TitleText = styled.div`
font-size: 20px;
color: ${(props) => props.theme.colors.greyScale7};
text-align: center;
font-weight: 500;
line-height: 30px;
`
const SubTitleText = styled.div`
font-size: 16px;
color: ${(props) => props.theme.colors.greyScale5};
text-align: center;
font-weight: 300;
line-height: 24px;
white-space: break-spaces;
text-align: center;
`
const ConfirmBtnRow = styled.div`
display: flex;
flex-direction: column;
grid-gap: 10px;
align-items: center;
`
const Container = styled.div`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 30px 30px;
grid-gap: 20px;
max-width: 400px;
`