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

Size fix: replace px with DIP #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,26 @@ Use in template:
...
<StarRating :value="rating" size="90" />
...
```

I found that in {NS}6+ the size attribute either doesn't work or it deforms the stars.
Therefore a solution is to use:

```xml
<StarRating :value="rating" scaleX="0.8" scaleY="0.8" />

```

## Properties

| Prop | Type | Description | Default Value |
|:----------------:|:---------------:| -------------------------------------------------- | -------------- |
| **value** | Number | The rating value | 1 |
| **size** | String, Number | Size in pixels of width and height of the star | 75 |
| **size** | String, Number | Size in DIP* of width and height of the star | 75 |
| **fillColor** | String | CSS color for the filled stars | <span style="color:#FFEB0A">'#FFEB0A'</span> |
| **emptyColor** | String | CSS color for the empty stars | <span style="color:#ABABAB">'#ABABAB'</span> |
| **outlineColor** | String | CSS color for the star outline | <span style="color:#000">'#000'</span> |

* DIP - device independent pixels
## Events

| Event | Returns | Description |
Expand Down
6 changes: 3 additions & 3 deletions components/Star.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
size: {
type: [String, Number],
required: false,
default: 75
default: 30
},
fillColor: {
type: String,
Expand All @@ -39,8 +39,8 @@ export default {
computed: {
starStyle() {
return {
width: `${this.size}px`,
height: `${this.size}px`,
width: `${this.size}`,
height: `${this.size}`,
background: `linear-gradient(90deg, ${this.fillColor} ${
this.percentage
}, ${this.emptyColor} ${this.percentage})`
Expand Down
2 changes: 1 addition & 1 deletion components/StarRating.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
size: {
type: [String, Number],
required: false,
default: 75
default: 30
},
fillColor: {
type: String,
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/panietoar/nativescript-vue-star-rating.git"
"url": "git+https://github.com/Rho-bur/nativescript-vue-star-rating.git"
},
"keywords": [
"nativescript",
Expand All @@ -19,11 +19,17 @@
],
"author": "Pablo nieto ([email protected])",
"license": "MIT",
"nativescript": {
"platforms": {
"android": "6.5.3",
"ios": "6.5.2"
}
},
"peerDependencies": {
"tns-core-modules": "*"
},
"bugs": {
"url": "https://github.com/panietoar/nativescript-vue-star-rating/issues"
"url": "https://github.com/Rho-bur/nativescript-vue-star-rating/issues"
},
"homepage": "https://github.com/panietoar/nativescript-vue-star-rating#readme"
"homepage": "https://github.com/Rho-bur/nativescript-vue-star-rating/blob/master/README.md"
}