Skip to content

Commit

Permalink
0.8.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinberonilla committed Jul 28, 2017
1 parent 4da3fb9 commit 35ab75c
Show file tree
Hide file tree
Showing 75 changed files with 799 additions and 160 deletions.
2 changes: 1 addition & 1 deletion aura/defaultTokens/defaultTokens.tokens-meta.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>38.0</apiVersion>
<apiVersion>40.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>
2 changes: 1 addition & 1 deletion aura/strike_badge/strike_badge.cmp
@@ -1,7 +1,7 @@
<!--
Strike by Appiphony

Version: 0.7.0
Version: 0.8.0
Website: http://www.lightningstrike.io
GitHub: https://github.com/appiphony/Strike-Components
License: BSD 2-Clause License
Expand Down
2 changes: 1 addition & 1 deletion aura/strike_badge/strike_badge.cmp-meta.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>38.0</apiVersion>
<apiVersion>40.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>
116 changes: 116 additions & 0 deletions aura/strike_carousel/strike_carousel.cmp
@@ -0,0 +1,116 @@
<!--
Strike by Appiphony

Version: 0.8.0
Website: http://www.lightningstrike.io
GitHub: https://github.com/appiphony/Strike-Components
License: BSD 2-Clause License
-->
<aura:component >
<aura:handler name="init" value="{!this}" action="{!c.onInit}"/>
<aura:registerEvent name="navigate" type="c:fiddle_evt_navigate"/>

<!-- External -->
<aura:attribute name="iconName" type="String" default="standard:carousel"/>
<aura:attribute name="title" type="String" default="Cards"/>
<aura:attribute name="showTotal" type="Boolean" default="{!true}"/>
<aura:attribute name="cards" type="Map[]"/>
<!-- /External -->

<!-- Internal -->
<aura:attribute name="pages" type="Integer[]"/>
<aura:attribute name="spacers" type="Integer[]"/>
<aura:attribute name="containerWidth" type="Integer" default="480"/>
<aura:attribute name="currentPage" type="Integer" default="0"/>
<aura:handler name="change" value="{!v.currentPage}" action="{!c.handleChangeCurrentPage}"/>
<!-- Internal -->


<aura:if isTrue="{!not(empty(v.cards))}">
<div class="slds-scope">
<div class="slds-box sc-p_none slds-theme_shade">
<aura:if isTrue="{!not(empty(v.title))}">
<header class="slds-card__header slds-media slds-media_center slds-has-flexi-truncate">
<aura:if isTrue="{!not(empty(v.iconName))}">
<div class="slds-media__figure">
<lightning:icon iconName="{!v.iconName}" size="small" title="title" />
</div>
</aura:if>

<div class="slds-media__body">
<h2 class="slds-text-heading_small">{!v.title} <aura:if isTrue="{!v.showTotal}"> ({!v.cards.length})</aura:if></h2>
</div>
</header>
</aura:if>

<!-- Empty State -->
<aura:if isTrue="{!not(v.cards.length gt 0)}">
<div class="slds-p-horizontal_small slds-text-align_center slds-m-bottom_xx-large slds-p-top_xxx-small"><em class="slds-text-color_weak">No records to display</em></div>
</aura:if>
<!-- /Empty State -->

<div class="{!'slds-grid slds-align_absolute-center slds-p-horizontal_large' + if(empty(v.title), ' slds-m-top_medium', '')}">

<!-- Previous Button -->
<aura:if isTrue="{!and(v.containerWidth gt 480, v.cards.length gt 3)}">
<div class="slds-col slds-no-flex slds-p-right_x-small">
<lightning:buttonIcon iconName="utility:chevronleft" alternativeText="Previous" size="small" variant="border-filled" onclick="{!c.handleClickPrevious}" />
</div>
</aura:if>
<!-- /Previous Button -->

<!-- Carousel Body -->
<div class="slds-col slds-scrollable_none">
<div aura:id="carousel-body" class="{!'sc-carousel-body slds-grid slds-grid_vertical-stretch slds-scrollable_none' + if(v.containerWidth lt 481, ' slds-wrap', '') + if(or(v.cards.length lt 4, v.containerWidth lt 481), ' slds-grid_pull-padded-x-small', '')}">

<aura:iteration items="{!v.cards}" var="card">
<!-- Card -->
<div class="{!'slds-col slds-no-flex slds-p-horizontal_x-small' + if(v.containerWidth gt 480, ' slds-size_1-of-3', ' slds-size_1-of-1') + if(or(v.cards.length lt 4, v.containerWidth lt 481), ' slds-m-bottom_large', '')}">
{!card}
</div>
<!-- /Card -->
</aura:iteration>
<aura:iteration items="{!v.spacers}" var="spacer">
<!-- Spacer -->
<div class="slds-col slds-no-flex slds-size_1-of-3 slds-p-horizontal_x-small"></div>
<!-- /Spacer -->
</aura:iteration>
</div>
</div>
<!-- /Carousel Body -->

<!-- Next Button -->
<aura:if isTrue="{!and(v.containerWidth gt 480, v.cards.length gt 3)}">
<div class="slds-col slds-no-flex slds-p-left_x-small">
<lightning:buttonIcon iconName="utility:chevronright" alternativeText="Next" size="small" variant="border-filled" onclick="{!c.handleClickNext}" />
</div>
</aura:if>
<!-- /Next Button -->

</div>

<!-- Pagination -->
<aura:if isTrue="{!and(v.containerWidth gt 480, v.cards.length gt 3)}">
<div class="slds-m-around_small">
<ul class="sc-pagination">
<aura:iteration items="{!v.pages}" var="page" indexVar="index">
<li><a aura:id="dot" href="javascript:void(0);" class="{!'sc-pagination__dot' + if(v.currentPage == index, ' sc-pagination__dot_selected', '')}" data-page="{!index}" onclick="{!c.handleClickDot}"></a></li>
</aura:iteration>
</ul>
</div>
</aura:if>
<!-- /Pagination -->
</div>
</div>
</aura:if>
</aura:component>
<!--
Copyright 2017 Appiphony, LLC

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
5 changes: 5 additions & 0 deletions aura/strike_carousel/strike_carousel.cmp-meta.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>40.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>
28 changes: 28 additions & 0 deletions aura/strike_carousel/strike_carousel.css
@@ -0,0 +1,28 @@
.THIS.slds-scope .sc-carousel-body > .slds-col {
display: flex;
align-items: stretch;
}
.THIS.slds-scope .sc-pagination {
list-style: none;
display: block;
text-align: center;
}
.THIS.slds-scope .sc-pagination__dot {
display: block;
width: 12px;
height: 12px;
border-radius: 12px;
border: 1px solid #c8cfda;
background: white;
}
.THIS.slds-scope .sc-pagination__dot_selected {
background: #d0d6e1;
}
.THIS.slds-scope .sc-pagination li {
display: inline-block;
padding-left: t(spacingXxSmall);
padding-right: t(spacingXxSmall);
}
.THIS.slds-scope .sc-p_none {
padding: 0;
}
59 changes: 59 additions & 0 deletions aura/strike_carousel/strike_carouselController.js
@@ -0,0 +1,59 @@
({
onInit: function(component, event, helper) {
var body = component.get('v.body');
var cards = [];
body.forEach(function(el) {
if (el.toString().match(/aura:iteration/)) {
var children = el.get('v.body');
cards = children;

} else {
cards.push(el);
}
});
component.set('v.cards', cards);

window.addEventListener('resize', function() {
helper.setContainerWidth(component, helper);
helper.scrollToPage(component, event, helper, component.get('v.currentPage'));
});

helper.displayCards(component, event, helper);
},
handleChangeCards: function(component, event, helper) {
helper.displayCards(component, event, helper);
},
handleChangeCurrentPage: function(component, event, helper) {
helper.updateDots(component, event, helper);
},
handleClickDot: function(component, event, helper) {
var page = parseInt(event.srcElement.dataset.page);
helper.scrollToPage(component, event, helper, page);
},
handleClickPrevious: function(component, event, helper) {
var newPage;
var currentPage = component.get('v.currentPage');
var lastPageIndex = component.get('v.pages').length - 1;

if (currentPage > 0) {
newPage = currentPage - 1;
} else {
newPage = lastPageIndex;
}

helper.scrollToPage(component, event, helper, newPage);
},
handleClickNext: function(component, event, helper) {
var newPage;
var currentPage = component.get('v.currentPage');
var lastPageIndex = component.get('v.pages').length - 1;

if (currentPage < lastPageIndex) {
newPage = currentPage + 1;
} else {
newPage = 0;
}

helper.scrollToPage(component, event, helper, newPage);
}
})
60 changes: 60 additions & 0 deletions aura/strike_carousel/strike_carouselHelper.js
@@ -0,0 +1,60 @@
({
displayCards: function(component, event, helper) {
var body = component.get('v.body')[0];
if(!$A.util.isEmpty(body)) {
var cardCount = component.get('v.cards').length;
var pageCount = Math.ceil(cardCount / 3);
var spacerCount = pageCount % cardCount || 0;
component.set('v.pages', new Array(pageCount));
component.set('v.spacers', new Array(spacerCount));
}
},
scrollToPage: function(component, event, helper, pageNumber) {
var containerWidth = component.get('v.containerWidth');

if (containerWidth > 480) {
var carouselBody = component.find('carousel-body').getElement();
var carouselBodyWidth = carouselBody.getBoundingClientRect().width;
var currentPage = component.get('v.currentPage');
var increment = (carouselBodyWidth * (pageNumber - currentPage)) / 60;
var speed = 250; // Milliseconds
var frameCount = 0;

var slideInterval = setInterval(function() {
frameCount++;
window.requestAnimationFrame(function() {
carouselBody.scrollLeft += increment;
});

if (frameCount === 60) {
clearInterval(slideInterval);
currentPage = pageNumber;
window.requestAnimationFrame(function() {
carouselBody.scrollLeft = carouselBodyWidth * currentPage;
});
}
}, speed * 0.01667);

component.set('v.currentPage', pageNumber);
helper.updateDots(component, event, helper);
}
},
updateDots: function(component, event, helper) {
var dots = component.find('dot');
var currentPage = component.get('v.currentPage');

dots.forEach(function(self, index) {
if (index == currentPage) {
self.getElement().classList.add('sc-pagination__dot_selected');
} else {
self.getElement().classList.remove('sc-pagination__dot_selected');
}
});
},
setContainerWidth: function(component, helper) {
if (component.getElement() !== null) {
var containerWidth = Math.ceil(component.getElement().getBoundingClientRect().width);
component.set('v.containerWidth', containerWidth);
}
}
})
6 changes: 6 additions & 0 deletions aura/strike_carousel/strike_carouselRenderer.js
@@ -0,0 +1,6 @@
({
afterRender: function(component, helper) {
helper.setContainerWidth(component, helper);
this.superAfterRender();
}
})
61 changes: 61 additions & 0 deletions aura/strike_carouselCard/strike_carouselCard.cmp
@@ -0,0 +1,61 @@
<!--
Strike by Appiphony

Version: 0.8.0
Website: http://www.lightningstrike.io
GitHub: https://github.com/appiphony/Strike-Components
License: BSD 2-Clause License
-->
<aura:component >
<aura:attribute name="imgSrc" type="String"/>
<aura:attribute name="imgHref" type="String"/>
<aura:attribute name="title" type="String"/>
<aura:attribute name="titleHref" type="String"/>
<aura:attribute name="buttonHref" type="String"/>
<aura:attribute name="buttonLabel" type="String"/>


<div class="sc-card slds-box slds-theme_default">
<aura:if isTrue="{!not(empty(v.imgHref))}">
<a href="{!v.imgHref}" target="_blank"><div class="{!'sc-card__image-container' + if(not(empty(v.imgHref)), ' sc-cursor--pointer')}" style="{!'background-image: url(' + v.imgSrc + ')'}"></div></a>

<aura:set attribute="else">
<div class="sc-card__image-container" style="{!'background-image: url(' + v.imgSrc + ')'}"></div>
</aura:set>
</aura:if>

<div class="sc-card__body">
<div class="sc-card__title_container">
<aura:if isTrue="{!not(empty(v.titleHref))}">
<h4 class="sc-card__title slds-text-heading_small" title="{!v.title}"><a href="{!v.titleHref}" target="_blank">{!v.title}</a></h4>

<aura:set attribute="else">
<h4 class="sc-card__title slds-text-heading_small" title="{!v.title}">{!v.title}</h4>
</aura:set>
</aura:if>
</div>

<aura:if isTrue="{!not(empty(v.buttonLabel))}">
<p class="slds-m-top_small">
<aura:if isTrue="{!not(empty(v.buttonHref))}">
<a href="{!v.buttonHref}" target="_blank" class="slds-button slds-button_neutral slds-truncate" title="{!v.buttonLabel}">{!v.buttonLabel}</a>

<aura:set attribute="else">
<div class="slds-button slds-button_neutral slds-truncate" title="{!v.buttonLabel}">{!v.buttonLabel}</div>
</aura:set>
</aura:if>
</p>
</aura:if>
</div>
</div>
</aura:component>
<!--
Copyright 2017 Appiphony, LLC

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
5 changes: 5 additions & 0 deletions aura/strike_carouselCard/strike_carouselCard.cmp-meta.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>40.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>

0 comments on commit 35ab75c

Please sign in to comment.