Last active
September 28, 2015 00:09
-
-
Save patowens/c81b2343cd305a8f0900 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
<dropdown> | |
<span class="handle { expanded: is_open }" onclick={ toggle }>{ opts.title }</span> | |
<ul> | |
<li each={ items } onclick={ select }></li> | |
</ul> | |
</dropdown> |
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
// require your favourite things.. | |
var dependency = require('your-favourite-lib'); | |
// logic comes here.. | |
this.items = [ | |
{ title: 'hello' }, | |
{ title: 'world' } | |
]; | |
toggle() { | |
this.is_open = !this.is_open; | |
}; | |
select(e) { | |
console.log('you have selected: ', e.target); | |
}; | |
this.on('mount', function() { | |
this.is_open = false; | |
// do things, perhaps with famous etc.. | |
}); |
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
// allowing scss please | |
dropdown { | |
span ul { | |
display:none; | |
} | |
span.expanded ul { | |
display: ""; | |
} | |
} |
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
<html> | |
<head></head> | |
<body> | |
<h1>Hello world, this is my page</h1> | |
<dropdown title="click here!" items={ someArrayOfItems }></dropdown> | |
</body> | |
</html> |
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
testComponent('dropdown', {title="click here!", items: [{ title: 'hello', 'world'}] }, function(err, document) { | |
f = feryt(document); | |
f.find('.handle').equals("click here!") | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment