addons/isl/src/comments/InlineCommentSuggestionActionBottomBar.tsxblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import * as stylex from '@stylexjs/stylex';
b69ab319import {Button} from 'isl-components/Button';
b69ab3110import {Row} from 'isl-components/Flex';
b69ab3111import {Icon} from 'isl-components/Icon';
b69ab3112
b69ab3113const styles = stylex.create({
b69ab3114 actionBarRow: {
b69ab3115 alignItems: 'flex-start',
b69ab3116 marginBlock: 1, // Ensure buttons in different themes have sufficient height, regardless of their border
b69ab3117 },
b69ab3118});
b69ab3119
b69ab3120export default function InlineCommentActionBottomBar({
b69ab3121 resolved = false,
b69ab3122 onAccept,
b69ab3123 onReject,
b69ab3124 acceptLabel,
b69ab3125 rejectLabel,
b69ab3126 isToggle = false,
b69ab3127}: {
b69ab3128 resolved: boolean;
b69ab3129 onAccept: () => unknown;
b69ab3130 onReject: () => unknown;
b69ab3131 acceptLabel?: string;
b69ab3132 rejectLabel?: string;
b69ab3133 isToggle?: boolean;
b69ab3134}) {
b69ab3135 return isToggle ? (
b69ab3136 <Row xstyle={styles.actionBarRow}>
b69ab3137 {!resolved ? (
b69ab3138 <Button onClick={onAccept} primary={true}>
b69ab3139 {acceptLabel ? acceptLabel : 'Apply'}
b69ab3140 <Icon icon="check" />
b69ab3141 </Button>
b69ab3142 ) : (
b69ab3143 <Button onClick={onReject}>
b69ab3144 {rejectLabel ? rejectLabel : 'Discard'}
b69ab3145 <Icon icon="close" />
b69ab3146 </Button>
b69ab3147 )}
b69ab3148 </Row>
b69ab3149 ) : (
b69ab3150 <Row xstyle={styles.actionBarRow}>
b69ab3151 <Button onClick={onAccept} primary={true}>
b69ab3152 {acceptLabel ? acceptLabel : 'Apply'}
b69ab3153 <Icon icon="check" />
b69ab3154 </Button>
b69ab3155 <Button onClick={onReject}>
b69ab3156 {rejectLabel ? rejectLabel : 'Discard'}
b69ab3157 <Icon icon="close" />
b69ab3158 </Button>
b69ab3159 </Row>
b69ab3160 );
b69ab3161}