Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
support links
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvonne Yip committed Jul 22, 2014
1 parent 716b57b commit f353ac0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
4 changes: 3 additions & 1 deletion demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
<core-menu>
<paper-item icon="refresh" label="Item 1"></paper-item>
<paper-item label="Item 2"></paper-item>
<paper-item label="Item 3"></paper-item>
<paper-item label="Item with a link">
<a href="http://www.polymer-project.org" xtarget="_self"></a>
</paper-item>
</core-menu>
</body>
</html>
9 changes: 9 additions & 0 deletions paper-item.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@ html /deep/ paper-item::shadow #ripple {
left: 0;
bottom: 0;
right: 0;
pointer-events: none;
}

html /deep/ paper-item::shadow #icon {
margin-right: 8px;
}

html /deep/ paper-item::shadow ::content > a {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
31 changes: 26 additions & 5 deletions paper-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@
Example:
<core-menu>
<paper-item icon="refresh">Refresh</paper-item>
<paper-item>Help</paper-item>
<paper-item>Sign Out</paper-item>
<paper-item icon="refresh" label="Refresh"></paper-item>
<paper-item label="Help"></paper-item>
<paper-item label="Sign Out"></paper-item>
</core-menu>
To use as a link, put an `&lt;a&gt;` element in the item.
Example:
<paper-item icon="home" label="Home">
<a href="http://www.polymer-project.org"></a>
</paper-item>
@class paper-item
-->

Expand All @@ -30,7 +38,7 @@

<link href="paper-item.css" rel="stylesheet" shim-shadowdom>

<polymer-element name="paper-item" attributes="label iconSrc icon" center horizontal layout on-click="{{clickAction}}">
<polymer-element name="paper-item" attributes="label iconSrc icon" center horizontal layout>

<template>

Expand Down Expand Up @@ -77,7 +85,20 @@
*/
icon: {value: ''}

}
},

eventDelegates: {
'down': 'downAction',
'up': 'upAction'
},

downAction: function(e) {
this.$.ripple.downAction(e);
},

upAction: function(e) {
this.$.ripple.upAction(e);
}
});
</script>
</polymer-element>

0 comments on commit f353ac0

Please sign in to comment.