diff --git a/overview/ui/main.reel/main.css b/overview/ui/main.reel/main.css index 50e4939..3705f40 100644 --- a/overview/ui/main.reel/main.css +++ b/overview/ui/main.reel/main.css @@ -102,4 +102,13 @@ td:nth-child(5) { background: hsl(0,0%,24%); } .digit-Video { margin: auto; -} \ No newline at end of file +} + +.StarRating-cell { + width: 70%; + margin: auto; +} + +.StarRating { + color: cornflowerblue; +} diff --git a/overview/ui/main.reel/main.html b/overview/ui/main.reel/main.html index be619ca..2f8a01a 100644 --- a/overview/ui/main.reel/main.html +++ b/overview/ui/main.reel/main.html @@ -204,6 +204,15 @@

Basic components

+ + + Star-Rating +
+
+
+
+ + diff --git a/overview/ui/main.reel/main.json b/overview/ui/main.reel/main.json index 0596e94..b89abe4 100644 --- a/overview/ui/main.reel/main.json +++ b/overview/ui/main.reel/main.json @@ -118,5 +118,11 @@ "bigListContent3": { "prototype": "ui/text.reel", "properties": { "element": {"#": "bigListContent-3"} }, "bindings": { "value": {"<-": "@bigList3:iteration.object"}} }, "bigList4": { "prototype": "ui/big-list.reel", "properties": { "element": {"#": "bigList-4"}, "content": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30] } }, "bigListItem4": { "prototype": "ui/list-item.reel", "properties": { "element": {"#": "bigListItem-4"} } }, - "bigListContent4": { "prototype": "ui/text.reel", "properties": { "element": {"#": "bigListContent-4"} }, "bindings": { "value": {"<-": "@bigList4:iteration.object"}} } + "bigListContent4": { "prototype": "ui/text.reel", "properties": { "element": {"#": "bigListContent-4"} }, "bindings": { "value": {"<-": "@bigList4:iteration.object"}} }, + + "starRating-1": { "prototype": "ui/star-rating.reel", "properties": { "element": {"#": "starRating-1"}}}, + "starRating-2": { "prototype": "ui/star-rating.reel", "properties": { "element": {"#": "starRating-2"}}}, + "starRating-3": { "prototype": "ui/star-rating.reel", "properties": { "element": {"#": "starRating-3"}}}, + "starRating-4": { "prototype": "ui/star-rating.reel", "properties": { "element": {"#": "starRating-4"}}} + } \ No newline at end of file diff --git a/ui/star-rating.reel/star-rating.css b/ui/star-rating.reel/star-rating.css new file mode 100644 index 0000000..5a5292f --- /dev/null +++ b/ui/star-rating.reel/star-rating.css @@ -0,0 +1,65 @@ +.StarRating { + display: flex; + display: -webkit-flex; + width: 100%; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-tap-highlight-color: transparent; + touch-action: none; +} + +.StarRating:hover { + cursor: pointer; +} + +.StarRating-items { + display: flex; + display: -webkit-flex; + flex: 1; + -webkit-flex: 1; + flex-direction: row; + -webkit-flex-direction: row; + flex-wrap: nowrap; +} + +.StarRating-item { + display: flex; + display: -webkit-flex; + flex: 1; + -webkit-flex: 1; +} + + +/* Wireframe ---------------------------------------------------------- */ + +[data-montage-skin="wireframe"] .StarRating .LinearGradient-firstStop { + stop-color: hsla(0, 0%, 30%, 0.7); +} + + +[data-montage-skin="wireframe"] .StarRating .BarRatingItem-svg { + stroke: hsla(0, 0%, 30%, 0.8); +} + + +/* Light ---------------------------------------------------------- */ + +[data-montage-skin="light"] .StarRating .LinearGradient-firstStop { + stop-color: hsla(0,0%,0%,.7); +} + +[data-montage-skin="light"] .StarRating .BarRatingItem-svg { + stroke: hsla(0,0%,0%,.8); +} + +/* Dark ---------------------------------------------------------- */ + +[data-montage-skin="dark"] .StarRating .LinearGradient-firstStop { + stop-color: hsl(0,0%,85%); +} + +[data-montage-skin="dark"] .StarRating .BarRatingItem-svg { + stroke: hsl(0,0%,90%); +} diff --git a/ui/star-rating.reel/star-rating.html b/ui/star-rating.reel/star-rating.html new file mode 100644 index 0000000..92db8f5 --- /dev/null +++ b/ui/star-rating.reel/star-rating.html @@ -0,0 +1,49 @@ + + + + + + + + +
+
+
+ + + +
+
+
+ + diff --git a/ui/star-rating.reel/star-rating.js b/ui/star-rating.reel/star-rating.js new file mode 100644 index 0000000..cd79b9a --- /dev/null +++ b/ui/star-rating.reel/star-rating.js @@ -0,0 +1,30 @@ +/** + * @module ui/star-rating.reel + * @requires montage/ui/component + */ +var RatingBar = require("montage/ui/rating-bar.reel").RatingBar; + +/** + * @class StarRating + * @extends RatingBar + */ +exports.StarRating = RatingBar.specialize(/** @lends StarRating# */ { + + + /** + * The number of stars. + * + * @type {number} + * @default 5 + */ + starCount: { + set: function(starCount) { + this.itemCount = starCount; + }, + get: function() { + return this._itemCount; + } + } + + +});