Created
May 4, 2020 23:14
-
-
Save JitendraZaa/5d37530330140dbb4e2ccdcce2a5b590 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
| <div class="slds-text-heading_large slds-text-align_center">Gravatar - Reusable Lightning Web Component</div> | |
| <div class="slds-grid"> | |
| <div class="slds-col slds-size_2-of-8"> | |
| <c-gravatar size={size} email={email} is-round-corner={isround}></c-gravatar> | |
| </div> | |
| <div class="slds-col slds-size_6-of-8"> | |
| <lightning-input type="number" name="input2" label="Image size in pixel" value={size} onchange={updateSize}></lightning-input> | |
| <lightning-input type="email" label="Email address" value={email} onblur={updateEmail}></lightning-input> | |
| <lightning-input type="checkbox" label="Rounded corner" value={isround} onchange={updateBorder}></lightning-input> | |
| </div> | |
| </div> | |
| </template> |
This file contains hidden or 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 } from 'lwc'; | |
| export default class GravatarDemo extends LightningElement { | |
| @track size = 150; | |
| @track email; | |
| @track isround; | |
| updateEmail (event){ | |
| //Check if email is valid or not using OOB LWC support | |
| if(event.target.validity.valid){ | |
| this.email = event.target.value; | |
| } | |
| } | |
| updateBorder(event){ | |
| this.isround = event.target.checked; | |
| } | |
| updateSize(event){ | |
| this.size = event.target.value; | |
| } | |
| } |
This file contains hidden or 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>48.0</apiVersion> | |
| <isExposed>true</isExposed> | |
| <targets> | |
| <target>lightningCommunity__Page</target> | |
| </targets> | |
| </LightningComponentBundle> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment