Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated components for the new changes in g-component #52

Merged
merged 2 commits into from
Jan 7, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/g-icon-button.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* license that can be found in the LICENSE file.
*/
-->
<element name="g-icon-button" attributes="src, active">
<element name="g-icon-button" attributes="src active">
<link rel="components" href="g-icon.html">
<template>
<style>
Expand All @@ -15,16 +15,13 @@
width: 40px;
height: 40px;
border: 1px solid transparent;
padding: 9px;
background: inherit;
padding: 3px;
cursor: pointer;
-webkit-transition: none;
}

@host:hover, @host.selected {
border: 1px solid rgba(0,0,0,0.16);
border-radius: 3px;
background: inherit;
opacity: 0.8;
}

Expand Down
7 changes: 3 additions & 4 deletions src/g-icon.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,17 @@
}

#icon {
width: 21px;
height: 21px;
width: 32px;
height: 32px;
cursor: pointer;
background: no-repeat center;
background-size: contain;
}
</style>
<div id="icon" style="background-image:url({{src}})"></div>
</template>
<script>
/**
* g-icon is a 21x21 glyph expressed as a background-image.
* g-icon is a 32x32 glyph expressed as a background-image.
* @module g-icon
*/
this.component();
Expand Down
5 changes: 2 additions & 3 deletions src/g-menu-button.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="components" href="g-overlay.html">
<link rel="components" href="g-menu.html"/>
<template>
<g-icon-button id="button" on-click="toggle" src="{{src}}"></g-icon-button>
<g-icon-button id="button" on-click="toggle" src="{{src}}" active="{{opened}}"></g-icon-button>
<g-overlay id="overlay" class="slideup" opened="{{opened}}">
<div class="arrow-border"></div>
<div class="arrow"></div>
Expand All @@ -26,8 +26,7 @@
publish: {
//* Toggle the opened state of the dropdown.
toggle: function() {
this.$.overlay.toggle();
this.$.button.active = this.$.overlay.opened;
this.opened = !this.opened;
},
//* Returns the selected item.
get selection() {
Expand Down
2 changes: 1 addition & 1 deletion src/g-menu-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@host {
display: block;
box-sizing: border-box;
padding: 11px 10px;
padding: 8px 10px;
margin: 10px;
border: 1px solid transparent;
border-radius: 3px;
Expand Down
2 changes: 1 addition & 1 deletion src/g-panels.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<element name="g-panels" attributes="transition, selected, index"
handlers="keydown: keydownHandler">
on-keydown="keydownHandler">
<link rel="components" href="g-component.html">
<link rel="components" href="panel-transitions/g-panel-transition.html">
<link rel="components" href="panel-transitions/g-keyframe-panel-transition.html">
Expand Down
17 changes: 11 additions & 6 deletions src/g-ratings.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* license that can be found in the LICENSE file.
*/
-->
<element name="g-ratings" attributes="count, value">
<element name="g-ratings" attributes="count value">
<link rel="components" href="g-component.html">
<template>
<style>
Expand All @@ -21,9 +21,14 @@
background: url('images/star_full.svg') center no-repeat;
}
</style>
<template iterate="stars">
<span index="{{index}}" class="star {{starClass}}" on-click="starClick"></span>
</template>
<!-- FIXME(ffu): in MDV polyfill, setting a model on a template element does
not cause the children to have the proper model. Workaround here to add a div
at the top-level. -->
<div>
<template iterate="stars">
<span index="{{index}}" class="star {{starClass}}" on-click="starClick"></span>
</template>
</div>
</template>
<script>
this.component({
Expand All @@ -42,8 +47,8 @@
s.starClass = i < this.value ? 'full' : '';
}.bind(this));
},
starClick: function(e) {
var s = e.currentTarget.model;
starClick: function(inEvent, inDetail, inSender) {
var s = inSender.model;
this.node.value = s.index + (s.starClass == 'full' ? 0 : 1);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/g-tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* license that can be found in the LICENSE file.
*/
-->
<element name="g-tabs" extends="g-selector" attributes="selected multi vertical" on-click="clickHandler">
<element name="g-tabs" extends="g-selector" attributes="selected multi vertical">
<link rel="components" href="g-selector.html">
<template>
<style>
Expand Down