1.6 KB62 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import * as stylex from '@stylexjs/stylex';
9import {Button} from 'isl-components/Button';
10import {Row} from 'isl-components/Flex';
11import {Icon} from 'isl-components/Icon';
12
13const styles = stylex.create({
14 actionBarRow: {
15 alignItems: 'flex-start',
16 marginBlock: 1, // Ensure buttons in different themes have sufficient height, regardless of their border
17 },
18});
19
20export default function InlineCommentActionBottomBar({
21 resolved = false,
22 onAccept,
23 onReject,
24 acceptLabel,
25 rejectLabel,
26 isToggle = false,
27}: {
28 resolved: boolean;
29 onAccept: () => unknown;
30 onReject: () => unknown;
31 acceptLabel?: string;
32 rejectLabel?: string;
33 isToggle?: boolean;
34}) {
35 return isToggle ? (
36 <Row xstyle={styles.actionBarRow}>
37 {!resolved ? (
38 <Button onClick={onAccept} primary={true}>
39 {acceptLabel ? acceptLabel : 'Apply'}
40 <Icon icon="check" />
41 </Button>
42 ) : (
43 <Button onClick={onReject}>
44 {rejectLabel ? rejectLabel : 'Discard'}
45 <Icon icon="close" />
46 </Button>
47 )}
48 </Row>
49 ) : (
50 <Row xstyle={styles.actionBarRow}>
51 <Button onClick={onAccept} primary={true}>
52 {acceptLabel ? acceptLabel : 'Apply'}
53 <Icon icon="check" />
54 </Button>
55 <Button onClick={onReject}>
56 {rejectLabel ? rejectLabel : 'Discard'}
57 <Icon icon="close" />
58 </Button>
59 </Row>
60 );
61}
62