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