Last active
September 1, 2020 16:07
-
-
Save dhaniksahni/5fab4fdf295f56c79684896dabe8d9e4 to your computer and use it in GitHub Desktop.
Common Dialog LWC Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<template if:true={open}> | |
<div> | |
<section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open"> | |
<div class="slds-modal__container"> | |
<header class="slds-modal__header"> | |
<lightning-button-icon class="slds-modal__close" icon-name="utility:close" onclick={closeModal}></lightning-button-icon> | |
<h2>{title}</h2> | |
</header> | |
<div class="slds-modal__content slds-var-p-around_medium"> | |
<slot name="body"></slot> | |
</div> | |
</div> | |
</section> | |
<div class="slds-backdrop slds-backdrop_open"></div> | |
</div> | |
</template> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LightningElement,track,api } from 'lwc'; | |
export default class CommonDialog extends LightningElement { | |
@track open = false; | |
@api title='Test'; | |
@api | |
openmodal() { | |
this.open = true | |
} | |
closeModal() { | |
this.open = false | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | |
<apiVersion>49.0</apiVersion> | |
<isExposed>true</isExposed> | |
<targets> | |
<target>lightningCommunity__Page</target> | |
<target>lightningCommunity__Default</target> | |
<target>lightning__RecordPage</target> | |
<target>lightning__AppPage</target> | |
<target>lightning__HomePage</target> | |
</targets> | |
<masterLabel>Common Dialog Box</masterLabel> | |
</LightningComponentBundle> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment