Skip to content

Commit

Permalink
Added ortoo Id generation to the confirmation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-baillie-ortoo committed Jan 11, 2022
1 parent 0916a86 commit b283f97
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<c-modal
visible={visible}
oncancel={handleCancel}
data-ortoo-elem-id={modalId}
>

<div slot="title">
Expand All @@ -15,20 +16,18 @@
<div slot="footer">

<lightning-button
data-ortoo-elem-id={cancelId}
class="slds-p-around_xxx-small"
variant="neutral"
name="cancel"
data-name="cancel"
label={cancelLabel}
title={cancelLabel}
onclick={handleCancel}
></lightning-button>

<lightning-button
data-ortoo-elem-id={confirmId}
class="slds-p-around_xxx-small"
variant="brand"
name="confirm"
data-name="confirm"
label={confirmLabel}
title={confirmLabel}
onclick={handleConfirm}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LightningElement, api } from 'lwc';
import configureElementIdGenerator from 'c/elementIdGenerator';

import CONFIRM_LABEL from '@salesforce/label/c.ortoo_core_confirm';
import CANCEL_LABEL from '@salesforce/label/c.ortoo_core_cancel';
Expand Down Expand Up @@ -70,7 +71,16 @@ export default class ConfirmationDialog extends LightningElement {

@api visible;

@api ortooElemIdPrefix = 'confirmation';

ortooIdConfiguration = {
modalId: '',
cancelId: 'cancel',
confirmId: 'confirm',
}

connectedCallback() {
configureElementIdGenerator( this );
this.confirmLabel = this.confirmLabel ? this.confirmLabel : buttonLabels[ this.type ].confirm;
this.cancelLabel = this.cancelLabel ? this.cancelLabel : buttonLabels[ this.type ].cancel;
}
Expand Down

0 comments on commit b283f97

Please sign in to comment.