Skip to content

Commit

Permalink
0.0.12 update
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyFresneau committed Jun 28, 2023
1 parent ca679db commit 110e706
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The following props can be passed to customize the appearance and behavior of th
The component emits the following events:

- `ratingSelected`: Triggered when a rating level is selected. The event payload is the selected rating value.
- `hoverRating`: Triggered when the mouse hovers over the rating meter. The event payload is the mouse event object.
- `ratingHovered`: Triggered when the mouse hovers over the rating meter. The event payload is the selected rating value.

<!-- Badges -->

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-rating",
"version": "0.0.1",
"version": "0.0.12",
"description": "Display or retrieve a score on a fully customisable scale.",
"homepage": "https://github.com/Aurion72/nuxt-rating#readme",
"repository": "Aurion72/nuxt-rating",
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/components/NuxtRating.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Props = {
const emit = defineEmits<{
ratingSelected: [rate: number];
hoverRating: [event: MouseEvent];
ratingHovered: [event: number];
}>();
const props = withDefaults(defineProps<Props>(), {
Expand Down Expand Up @@ -63,7 +63,7 @@ const cssVars = computed(() => ({
const handleMouseMove = (event: MouseEvent) => {
if (props.readOnly) return;
emit("hoverRating", event);
emit("ratingHovered", calculateRating(event));
hoveredRating.value = calculateRating(event);
};
Expand Down Expand Up @@ -95,14 +95,15 @@ function calculateRating(event: MouseEvent): number {
width: auto;
display: inline-block;
vertical-align: baseline;
height: 0px;
font-size: var(--rating-size);
cursor: var(--cursor-type);
}
.average-rating::before {
--percent: calc(var(--rating-value) / var(--rating-count) * 100%);
content: var(--rating-content);
position: absolute;
position: relative;
top: 0;
left: 0;
color: rgba(0, 0, 0, 0.2);
Expand Down

0 comments on commit 110e706

Please sign in to comment.