-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
281 additions
and
20 deletions.
There are no files selected for viewing
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
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
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
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
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
25 changes: 25 additions & 0 deletions
25
force-app/main/default/lwc/indicatorBundleBadge/__tests__/indicatorBundleBadge.test.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { createElement } from 'lwc'; | ||
import IndicatorBundleBadge from 'c/indicatorBundleBadge'; | ||
|
||
describe('c-indicator-bundle-badge', () => { | ||
afterEach(() => { | ||
// The jsdom instance is shared across test cases in a single file so reset the DOM | ||
while (document.body.firstChild) { | ||
document.body.removeChild(document.body.firstChild); | ||
} | ||
}); | ||
|
||
it('TODO: test case generated by CLI command, please fill in test logic', () => { | ||
// Arrange | ||
const element = createElement('c-indicator-bundle-badge', { | ||
is: IndicatorBundleBadge | ||
}); | ||
|
||
// Act | ||
document.body.appendChild(element); | ||
|
||
// Assert | ||
// const div = element.shadowRoot.querySelector('div'); | ||
expect(1).toBe(1); | ||
}); | ||
}); |
5 changes: 5 additions & 0 deletions
5
force-app/main/default/lwc/indicatorBundleBadge/indicatorBundleBadge.css
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.indicatorBadge { | ||
--slds-c-badge-color-background: var(--backgroundColor); | ||
--slds-c-badge-icon-color-foreground: var(--foregroundColor); | ||
--slds-c-badge-text-color: var(--textColor); | ||
} |
11 changes: 11 additions & 0 deletions
11
force-app/main/default/lwc/indicatorBundleBadge/indicatorBundleBadge.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<div class="slds-var-m-bottom_x-small slds-float_left"> | ||
<lightning-badge | ||
label={indText} | ||
icon-name={indIcon} | ||
icon-alternative-text={indHoverText} | ||
icon-position={indIconPosition} | ||
class={indClass}> | ||
</lightning-badge> | ||
</div> | ||
</template> |
37 changes: 37 additions & 0 deletions
37
force-app/main/default/lwc/indicatorBundleBadge/indicatorBundleBadge.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class IndicatorBundleBadge extends LightningElement { | ||
|
||
@api indText = ''; | ||
@api indIcon = 'standard:marketing_actions'; | ||
@api indHoverText = ''; | ||
@api indIconPosition = 'start'; | ||
@api indBackgroundColor; | ||
@api indForegroundColor; | ||
@api indTextColor; | ||
|
||
get indClass() { | ||
let classValue = ''; | ||
if(this.indBackgroundColor || this.indForegroundColor || this.indTextColor){ | ||
classValue = 'indicatorBadge '; | ||
} | ||
|
||
return classValue; | ||
} | ||
|
||
renderedCallback() { | ||
this.initCSSVariables(); | ||
} | ||
|
||
initCSSVariables() { | ||
|
||
if(this.indBackgroundColor || this.indForegroundColor || this.indTextColor){ | ||
var css = this.template.querySelector(".indicatorBadge").style; | ||
|
||
css.setProperty('--backgroundColor', this.indBackgroundColor); | ||
css.setProperty('--foregroundColor', this.indForegroundColor); | ||
css.setProperty('--textColor', this.indTextColor); | ||
} | ||
|
||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
force-app/main/default/lwc/indicatorBundleBadge/indicatorBundleBadge.js-meta.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>62.0</apiVersion> | ||
<isExposed>false</isExposed> | ||
</LightningComponentBundle> |
25 changes: 25 additions & 0 deletions
25
...efault/objects/Indicator_Item_Extension__mdt/fields/Badge_Icon_Position__c.field-meta.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<fullName>Badge_Icon_Position__c</fullName> | ||
<externalId>false</externalId> | ||
<fieldManageability>SubscriberControlled</fieldManageability> | ||
<label>Badge Icon Position</label> | ||
<required>false</required> | ||
<type>Picklist</type> | ||
<valueSet> | ||
<restricted>true</restricted> | ||
<valueSetDefinition> | ||
<sorted>false</sorted> | ||
<value> | ||
<fullName>start</fullName> | ||
<default>false</default> | ||
<label>Start</label> | ||
</value> | ||
<value> | ||
<fullName>end</fullName> | ||
<default>false</default> | ||
<label>End</label> | ||
</value> | ||
</valueSetDefinition> | ||
</valueSet> | ||
</CustomField> |
12 changes: 12 additions & 0 deletions
12
...n/default/objects/Indicator_Item_Extension__mdt/fields/Badge_Text_Color__c.field-meta.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<fullName>Badge_Text_Color__c</fullName> | ||
<externalId>false</externalId> | ||
<fieldManageability>SubscriberControlled</fieldManageability> | ||
<inlineHelpText></inlineHelpText> | ||
<label>Bdage Text Color</label> | ||
<length>255</length> | ||
<required>false</required> | ||
<type>Text</type> | ||
<unique>false</unique> | ||
</CustomField> |
Oops, something went wrong.