yeoman - http://yeoman.io/
Created
November 12, 2015 05:29
-
-
Save shanimal/a8261f4e209ff1fce146 to your computer and use it in GitHub Desktop.
Notes for a Generic Component Based Application
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
<div id="SomeCalculatorContainer"> | |
<c-loan-calculator></c-loan-calculator> | |
</div> | |
<style> | |
#SomeCalculatorContainer { | |
height:500px; | |
width:250px; | |
padding:$componentPadding; | |
} | |
</style> |
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
/** | |
* LoanCalculator Component | |
* @author eBay Classifieds Group | |
* @version Bolt2.0 | |
* @link http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html | |
* @link https://github.com/benjaminapetersen/angular-element-query | |
* | |
* Please document LoanCalculator religiously | |
*/ | |
angular.module('LoanCalculator', []) | |
.directive('cLoanCalculator', function() { | |
return { | |
scope: {}, | |
templateUrl: 'LoanCalculator.hbs', | |
replace: true, | |
controller: 'LoanCalculatorCtrl', | |
controllerAs: 'ctrl' | |
}; | |
}) | |
.controller('LoanCalculatorCtrl', ["$scope","component","rateService",function($scope,component,rateService){ | |
_init(); | |
function _init(){ | |
component.elementQuery.subscribe('widths', onResize); | |
rateService.subscribe(onRateChange) | |
} | |
function save(view){ | |
} | |
// expose interface | |
this.save = save | |
}); |
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 "theme"; | |
/* | |
* Keep .LoanCalculator selectors and declarations inside its block. This namespaces your component and prevents collisions. | |
* Keep your selector tree shallow by defining unique elements on the root of your component | |
* Document this document vigilantly | |
* The theme file includes base element selectors for generic element behavior, font-sizes, component padding, you can override these in your component. | |
* hard code generic colors and assume the container controls component margins, dimensions and positioning. | |
* media-breakpoints allows us to modify the component as it changes size with sm, md, lg, xl selectors | |
.sm:200-400 | |
.md:401-600 | |
.lg:601-80 | |
.xl-801+ | |
TODO: Add git commit hook that prevents selectors outside the .LoanCalculator block; | |
https://github.com/sass/sass/issues/279 (points to template using grunt sass --watch sass:css -I "sass/themes/alaMaula") | |
*/ | |
.component.LoanCalculator { | |
h1 { | |
@include %componentHeader; | |
} | |
.footer .button { | |
float:right; | |
} | |
// when the component is really small lets change the way it looks | |
&.sm button { | |
float:none; | |
margin:0 auto; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment