playbook_ui 13.11.1.pre.alpha.play900startratingasinput1530 → 13.12.0.pre.alpha.PLAY880cardkithighlightzindex1655
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +0 -1
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_default_swift.md +11 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_props_swift.md +7 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_reverse_swift.md +13 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_size_swift.md +11 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md +15 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md +5 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md +15 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md +15 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_children_swift.md +14 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_dashed_swift.md +7 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_line_swift.md +8 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_props_swift.md +8 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_text_swift.md +7 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical_swift.md +18 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +8 -0
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +49 -61
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +54 -151
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.html.erb +1 -11
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.jsx +2 -17
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.html.erb +1 -6
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx +5 -22
- data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +5 -10
- data/app/pb_kits/playbook/pb_star_rating/docs/index.js +0 -6
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +15 -56
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +6 -49
- data/app/pb_kits/playbook/pb_star_rating/star_rating.test.js +34 -33
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on_swift.md +35 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md +29 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled_swift.md +13 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error_swift.md +24 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_props_swift.md +13 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default_swift.md +27 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error_swift.md +11 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_props_swift.md +9 -0
- data/app/pb_kits/playbook/pb_textarea/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default_swift.md +11 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name_swift.md +10 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_props_swift.md +6 -0
- data/app/pb_kits/playbook/pb_toggle/docs/example.yml +4 -0
- data/dist/playbook-rails.js +5 -5
- data/lib/playbook/version.rb +2 -2
- metadata +27 -10
- data/app/pb_kits/playbook/pb_star_rating/custom-icons.js +0 -356
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.html.erb +0 -7
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.jsx +0 -40
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.html.erb +0 -12
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.jsx +0 -57
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.html.erb +0 -23
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.jsx +0 -59
- data/app/pb_kits/playbook/pb_star_rating/star.svg +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2df1a239bdc2543fe0c643adbd48ecf1083b5627a3aaff5018f4bc4b5c6f3501
|
4
|
+
data.tar.gz: '095f3ef35c2083b78218da353d974108a2ca70127e12d760f07eef70e31b423a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5643ac4dd6cd99c4164f7b0125a1d37cfeb3b4b7b7960cc7a27572ddab5847f4b9f429f4b77d8d6ba04a3303a66dc101f8f57d7354da12be7f3ccaf227d221fd
|
7
|
+
data.tar.gz: b7f61a87d132dc21a018945ecd1ffa5aca675ff883ed07cc5a829ec488aa5a1e241bfdacddf81fdd74a8eb25bc91d86a6ca1aae3e5940a8005954af316823de4
|
@@ -0,0 +1,11 @@
|
|
1
|
+
![mulitple-users-default](https://github.com/powerhome/playbook/assets/92755007/73dffd55-14f7-468e-b6ea-4e700980183d)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let twoUsers = [andrew, picAndrew]
|
6
|
+
|
7
|
+
PBDoc(title: "xSmall") {
|
8
|
+
PBMultipleUsers(users: twoUsers, size: .xSmall)
|
9
|
+
}
|
10
|
+
|
11
|
+
```
|
@@ -0,0 +1,7 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **Users** | `[PBUser]` | Sets the user's avatars | | |
|
5
|
+
| **Size** | `AvatarSize` | Changes the size of the avatars | `.small` | `.xSmall` `.small` |
|
6
|
+
| **Reversed** | `Bool` | Changes the order of the avatars | `false` | `true` `false` |
|
7
|
+
| **Max Displayed Users** | `Int` | Limits the number of avatars displayed | `4` | |
|
@@ -0,0 +1,13 @@
|
|
1
|
+
![multiple-users-reverse](https://github.com/powerhome/playbook/assets/92755007/be3f6f7d-f699-40f2-bbb6-8a99144a8744)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let multipleUsers = [andrew, picAndrew, andrew, andrew]
|
6
|
+
let twoUsers = [andrew, picAndrew]
|
7
|
+
|
8
|
+
VStack(alignment: .leading, spacing: Spacing.small) {
|
9
|
+
PBMultipleUsers(users: multipleUsers, size: .small, reversed: true)
|
10
|
+
PBMultipleUsers(users: twoUsers, size: .small, reversed: true)
|
11
|
+
}
|
12
|
+
|
13
|
+
```
|
@@ -0,0 +1,11 @@
|
|
1
|
+
![mulitple-users-size](https://github.com/powerhome/playbook/assets/92755007/5c15b862-fb32-4e0a-a826-bc25b1db555e)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let multipleUsers = [andrew, picAndrew, andrew, andrew]
|
6
|
+
|
7
|
+
PBDoc(title: "Small") {
|
8
|
+
PBMultipleUsers(users: multipleUsers, size: .small)
|
9
|
+
}
|
10
|
+
|
11
|
+
```
|
@@ -10,3 +10,9 @@ examples:
|
|
10
10
|
- multiple_users_default: Default
|
11
11
|
- multiple_users_reverse: Reverse
|
12
12
|
- multiple_users_size: Size
|
13
|
+
|
14
|
+
swift:
|
15
|
+
- multiple_users_default_swift: Default
|
16
|
+
- multiple_users_reverse_swift: Reverse
|
17
|
+
- multiple_users_size_swift: Small
|
18
|
+
- multiple_users_props_swift: ""
|
data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
![mulitple-users-stacked-default](https://github.com/powerhome/playbook/assets/92755007/180e1275-3eb6-4b28-b1ef-bdde45ab3c2e)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let oneUser = [andrew]
|
6
|
+
let twoUsers = [andrew, picAndrew]
|
7
|
+
let multipleUsers = [andrew, picAndrew, andrew, andrew]
|
8
|
+
|
9
|
+
HStack(spacing: Spacing.xSmall) {
|
10
|
+
PBMultipleUsersStacked(users: oneUser, size: .default)
|
11
|
+
PBMultipleUsersStacked(users: twoUsers, size: .default)
|
12
|
+
PBMultipleUsersStacked(users: multipleUsers, size: .default)
|
13
|
+
}
|
14
|
+
|
15
|
+
```
|
data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **Users** | `[PBUser]` | Sets the user's avatars | | |
|
5
|
+
| **Size** | `Size` | Changes the size of the avatars | `.small` | `.default` `.small` `.xSmall` |
|
data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
![mulitple-users-stacked-small](https://github.com/powerhome/playbook/assets/92755007/277fd685-6302-462e-a02a-18a8fcb57715)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let oneUser = [andrew]
|
6
|
+
let twoUsers = [andrew, picAndrew]
|
7
|
+
let multipleUsers = [andrew, picAndrew, andrew, andrew]
|
8
|
+
|
9
|
+
HStack(spacing: Spacing.xSmall) {
|
10
|
+
PBMultipleUsersStacked(users: oneUser)
|
11
|
+
PBMultipleUsersStacked(users: twoUsers)
|
12
|
+
PBMultipleUsersStacked(users: multipleUsers)
|
13
|
+
}
|
14
|
+
|
15
|
+
```
|
data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
![mulitple-users-stacked-xsmall](https://github.com/powerhome/playbook/assets/92755007/4f31976f-a41b-4923-9230-5015f6ad75f8)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let oneUser = [andrew]
|
6
|
+
let twoUsers = [andrew, picAndrew]
|
7
|
+
let multipleUsers = [andrew, picAndrew, andrew, andrew]
|
8
|
+
|
9
|
+
HStack(spacing: Spacing.xSmall) {
|
10
|
+
PBMultipleUsersStacked(users: oneUser, size: .xSmall)
|
11
|
+
PBMultipleUsersStacked(users: twoUsers, size: .xSmall)
|
12
|
+
PBMultipleUsersStacked(users: multipleUsers, size: .xSmall)
|
13
|
+
}
|
14
|
+
|
15
|
+
```
|
@@ -6,3 +6,9 @@ examples:
|
|
6
6
|
|
7
7
|
react:
|
8
8
|
- multiple_users_stacked_default: Default
|
9
|
+
|
10
|
+
swift:
|
11
|
+
- multiple_users_stacked_default_swift: Default
|
12
|
+
- multiple_users_stacked_small_swift: Small
|
13
|
+
- multiple_users_stacked_xsmall_swift: xSmall
|
14
|
+
- multiple_users_stacked_props_swift: ""
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
![section-separator-children](https://github.com/powerhome/playbook/assets/92755007/acd6a8eb-d034-4efd-b2e6-afabe739e678)
|
3
|
+
|
4
|
+
```swift
|
5
|
+
|
6
|
+
PBSectionSeparator(variant: .dashed) {
|
7
|
+
PBCard(alignment: .center, borderRadius: BorderRadius.rounded, padding: Spacing.xxSmall, width: 70) {
|
8
|
+
Text("Today")
|
9
|
+
.pbFont(.caption)
|
10
|
+
.frame(maxWidth: .infinity, alignment: .center)
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
```
|
@@ -0,0 +1,8 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **text** | `String` | Adds text to the Section Separator | `nil` | |
|
5
|
+
| **orientation** | `Orientation` | Changes the orientation | `.horizontal` | `.horizontal` `.vertical` |
|
6
|
+
| **variant** | `Variant` | Changes the style of the Section Separator | `.card` | `.dashed` `.card` |
|
7
|
+
| **dividerOpacity** | `CGFloat` | Adjusts the opacity of the divider | `1` | |
|
8
|
+
| **margin** | `CGFloat` | Adds margin between text and the divider | `Spacing.xSmall` | `Spacing.none` `Spacing.xxSmall` `Spacing.xSmall` `Spacing.small` `Spacing.medium` `Spacing.large` `Spacing.xLarge` |
|
@@ -0,0 +1,18 @@
|
|
1
|
+
![section-separator-verticle](https://github.com/powerhome/playbook/assets/92755007/21ca54a5-6b8a-459f-91ad-4e9b68258f68)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
let loremIpsum: some View = Text(
|
6
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididt labore et dolore"
|
7
|
+
)
|
8
|
+
|
9
|
+
HStack(spacing: Spacing.none) {
|
10
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididt labore et dolore"
|
11
|
+
PBSectionSeparator(orientation: .vertical)
|
12
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididt labore et dolore"
|
13
|
+
}
|
14
|
+
.frame(maxWidth: .infinity)
|
15
|
+
.frame(height: 120, alignment: .center)
|
16
|
+
.listRowSeparator(.hidden)
|
17
|
+
|
18
|
+
```
|
@@ -13,3 +13,11 @@ examples:
|
|
13
13
|
- section_separator_text: Text Separator
|
14
14
|
- section_separator_vertical: Vertical
|
15
15
|
- section_separator_children: Children
|
16
|
+
|
17
|
+
swift:
|
18
|
+
- section_separator_line_swift: Line Separator
|
19
|
+
- section_separator_dashed_swift: Dashed Separator
|
20
|
+
- section_separator_text_swift: Text Separator
|
21
|
+
- section_separator_vertical_swift: Vertical
|
22
|
+
- section_separator_children_swift: Children
|
23
|
+
- section_separator_props_swift: ""
|
@@ -2,73 +2,61 @@
|
|
2
2
|
@import "../tokens/opacity";
|
3
3
|
@import "../tokens/spacing";
|
4
4
|
|
5
|
+
$pb_star_rating_number_width: 30px;
|
6
|
+
$pb_star_rating_wrapper_width: 90px;
|
7
|
+
$pb_star_rating_height: 26px;
|
5
8
|
|
6
|
-
[class
|
7
|
-
|
8
|
-
|
9
|
+
[class^=pb_star_rating_kit] {
|
10
|
+
position: relative;
|
11
|
+
display: inline-flex;
|
9
12
|
justify-content: flex-start;
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
|
23
|
-
.number_rails_lg {
|
24
|
-
height: 38px;
|
25
|
-
}
|
26
|
-
|
27
|
-
.pb_star_rating_wrapper {
|
13
|
+
align-items: flex-start;
|
14
|
+
|
15
|
+
.pb_star_rating_number {
|
16
|
+
flex-shrink: 0;
|
17
|
+
flex-grow: 0;
|
18
|
+
flex-basis: $pb_star_rating_number_width;
|
19
|
+
width: $pb_star_rating_number_width;
|
20
|
+
min-height: $pb_star_rating_height;
|
21
|
+
padding: 0 $space-xs 0;
|
22
|
+
color: $text_lt_light;
|
23
|
+
font-size: $text-small;
|
28
24
|
display: flex;
|
29
|
-
}
|
30
|
-
|
31
|
-
.pb_star_rating_number_xs {
|
32
|
-
max-height: 16px;
|
33
|
-
}
|
34
|
-
|
35
|
-
.pb_star_rating_number_sm {
|
36
|
-
max-height: 16px;
|
37
|
-
}
|
38
|
-
|
39
|
-
.pb_star_rating_number_md {
|
40
|
-
max-height: 32px;
|
41
|
-
}
|
42
|
-
|
43
|
-
.pb_star_rating_number_lg {
|
44
|
-
max-height: 56px;
|
45
|
-
}
|
46
|
-
|
47
|
-
.pb_star_xs {
|
48
|
-
display: flex;
|
49
|
-
align-items: center;
|
50
25
|
justify-content: center;
|
51
|
-
padding-right: 4px;
|
52
|
-
}
|
53
|
-
|
54
|
-
.pb_star_sm {
|
55
|
-
display: flex;
|
56
26
|
align-items: center;
|
57
|
-
justify-content: center;
|
58
|
-
padding-right: 4px;
|
59
27
|
}
|
60
28
|
|
61
|
-
.
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
29
|
+
.pb_star_rating_wrapper {
|
30
|
+
position: relative;
|
31
|
+
width: $pb_star_rating_wrapper_width;
|
32
|
+
flex-basis: $pb_star_rating_wrapper_width;
|
33
|
+
flex-shrink: 0;
|
34
|
+
flex-grow: 1;
|
35
|
+
min-height: $pb_star_rating_height;
|
36
|
+
|
37
|
+
.pb_star_rating_highlight {
|
38
|
+
display: flex;
|
39
|
+
position: absolute;
|
40
|
+
top: 5px;
|
41
|
+
left: 0;
|
42
|
+
z-index: 5;
|
43
|
+
color: $yellow;
|
44
|
+
line-height: $pb_star_rating_height;
|
45
|
+
}
|
46
|
+
.pb_star_rating_base {
|
47
|
+
display: flex;
|
48
|
+
position: absolute;
|
49
|
+
top: 5px;
|
50
|
+
left: 0;
|
51
|
+
z-index: 0;
|
52
|
+
color: rgba($slate, $opacity-4);
|
53
|
+
line-height: $pb_star_rating_height;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
&[class*=_hide_rating] {
|
58
|
+
.pb_star_rating_number {
|
59
|
+
display: none;
|
60
|
+
}
|
73
61
|
}
|
74
62
|
}
|
@@ -2,36 +2,27 @@ import React from "react"
|
|
2
2
|
import classnames from "classnames"
|
3
3
|
|
4
4
|
import { buildAriaProps, buildDataProps } from "../utilities/props"
|
5
|
-
|
6
|
-
import
|
7
|
-
import Title from '../pb_title/_title'
|
5
|
+
|
6
|
+
import Icon from "../pb_icon/_icon"
|
8
7
|
|
9
8
|
type StarRatingProps = {
|
10
9
|
aria?: {[key: string]: string},
|
11
10
|
className?: string,
|
12
11
|
data?: object,
|
13
|
-
dark?: boolean,
|
14
12
|
fixedWidth?: boolean,
|
15
|
-
|
13
|
+
hideRating: boolean,
|
16
14
|
icon?: string,
|
17
15
|
id?: string,
|
18
16
|
rating: number,
|
19
|
-
denominator: number,
|
20
|
-
colorOption?: "yellow" | "primary" | "subtle" | "outline",
|
21
|
-
size?: "xs" | "sm" | "md" | "lg";
|
22
17
|
};
|
23
18
|
|
24
19
|
const StarRating = ({
|
25
20
|
aria = {},
|
26
21
|
className,
|
27
22
|
data = {},
|
28
|
-
|
29
|
-
layoutOption = "default",
|
23
|
+
hideRating = false,
|
30
24
|
id,
|
31
25
|
rating = 0,
|
32
|
-
denominator = 5,
|
33
|
-
colorOption = "yellow",
|
34
|
-
size = "sm",
|
35
26
|
}: StarRatingProps) => {
|
36
27
|
const ariaProps = buildAriaProps(aria)
|
37
28
|
const dataProps = buildDataProps(data)
|
@@ -39,51 +30,12 @@ const StarRating = ({
|
|
39
30
|
"pb_star_rating_kit", className,
|
40
31
|
])
|
41
32
|
|
42
|
-
const
|
43
|
-
|
44
|
-
const emptyStars = denominatorStyle - Math.round(rating) < 0 ? 0 : denominatorStyle - Math.round(rating)
|
45
|
-
let svgSize
|
46
|
-
|
47
|
-
if (size === 'xs') {
|
48
|
-
svgSize = 14;
|
49
|
-
} else if (size === 'sm') {
|
50
|
-
svgSize = 16;
|
51
|
-
} else if (size === 'md') {
|
52
|
-
svgSize = 24;
|
53
|
-
} else if (size === 'lg') {
|
54
|
-
svgSize = 48;
|
55
|
-
} else {
|
56
|
-
svgSize = 16;
|
57
|
-
}
|
58
|
-
|
59
|
-
const starYellow = (
|
60
|
-
<svg width={svgSize} height={svgSize} viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
61
|
-
<path fillRule="evenodd" clipRule="evenodd" d="M9.86015 0.4371C9.73527 0.187329 9.4855 0 9.17328 0C8.89229 0 8.64252 0.187329 8.51763 0.4371L6.36335 4.83932L1.58647 5.55742C1.30547 5.58864 1.08692 5.80719 0.99326 6.05696C0.899595 6.33795 0.962038 6.61895 1.18059 6.8375L4.64617 10.2719L3.80319 15.1112C3.77197 15.3922 3.89685 15.7044 4.11541 15.8605C4.36518 16.0166 4.64617 16.0478 4.89594 15.9229L9.17328 13.6126L13.4506 15.9229C13.7004 16.0478 14.0126 16.0166 14.2624 15.8605C14.4809 15.7044 14.6058 15.3922 14.5434 15.1112L13.7316 10.2719L17.1972 6.8375C17.4157 6.61895 17.4782 6.33795 17.3845 6.05696C17.2909 5.80719 17.0723 5.58864 16.7913 5.55742L12.0144 4.83932L9.86015 0.4371Z" fill="#F9BB00"/>
|
62
|
-
</svg>
|
63
|
-
)
|
64
|
-
|
65
|
-
const starPrimary = (
|
66
|
-
<svg width={svgSize} height={svgSize} viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
67
|
-
<path fillRule="evenodd" clipRule="evenodd" d="M9.86015 0.4371C9.73527 0.187329 9.4855 0 9.17328 0C8.89229 0 8.64252 0.187329 8.51763 0.4371L6.36335 4.83932L1.58647 5.55742C1.30547 5.58864 1.08692 5.80719 0.99326 6.05696C0.899595 6.33795 0.962038 6.61895 1.18059 6.8375L4.64617 10.2719L3.80319 15.1112C3.77197 15.3922 3.89685 15.7044 4.11541 15.8605C4.36518 16.0166 4.64617 16.0478 4.89594 15.9229L9.17328 13.6126L13.4506 15.9229C13.7004 16.0478 14.0126 16.0166 14.2624 15.8605C14.4809 15.7044 14.6058 15.3922 14.5434 15.1112L13.7316 10.2719L17.1972 6.8375C17.4157 6.61895 17.4782 6.33795 17.3845 6.05696C17.2909 5.80719 17.0723 5.58864 16.7913 5.55742L12.0144 4.83932L9.86015 0.4371Z" fill="#0056CF"/>
|
68
|
-
</svg>
|
69
|
-
);
|
70
|
-
|
71
|
-
const starSubtle = (
|
72
|
-
<svg width={svgSize} height={svgSize} viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
73
|
-
<path fill={dark === true ? "$text_dk_default" : "#242B42"} fillRule="evenodd" clipRule="evenodd" d="M8.90904 0.4371C8.78416 0.187329 8.53438 0 8.22217 0C7.94118 0 7.69141 0.187329 7.56652 0.4371L5.41224 4.83932L0.635357 5.55742C0.354364 5.58864 0.135813 5.80719 0.042149 6.05696C-0.0515154 6.33795 0.0109275 6.61895 0.229478 6.8375L3.69506 10.2719L2.85208 15.1112C2.82086 15.3922 2.94574 15.7044 3.16429 15.8605C3.41407 16.0166 3.69506 16.0478 3.94483 15.9229L8.22217 13.6126L12.4995 15.9229C12.7493 16.0478 13.0615 16.0166 13.3113 15.8605C13.5298 15.7044 13.6547 15.3922 13.5923 15.1112L12.7805 10.2719L16.2461 6.8375C16.4646 6.61895 16.5271 6.33795 16.4334 6.05696C16.3397 5.80719 16.1212 5.58864 15.8402 5.55742L11.0633 4.83932L8.90904 0.4371Z" />
|
74
|
-
</svg>
|
75
|
-
);
|
76
|
-
|
77
|
-
const starBackground = (
|
78
|
-
<svg width={svgSize} height={svgSize} viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
79
|
-
<path fill={dark === true ? "$border_dark" : "#E4E8F0"} fillRule="evenodd" clipRule="evenodd" d="M9.31126 0.4371C9.18638 0.187329 8.93661 0 8.62439 0C8.3434 0 8.09363 0.187329 7.96874 0.4371L5.81446 4.83932L1.03758 5.55742C0.756585 5.58864 0.538035 5.80719 0.444371 6.05696C0.350706 6.33795 0.413149 6.61895 0.631699 6.8375L4.09728 10.2719L3.2543 15.1112C3.22308 15.3922 3.34797 15.7044 3.56652 15.8605C3.81629 16.0166 4.09728 16.0478 4.34705 15.9229L8.62439 13.6126L12.9017 15.9229C13.1515 16.0478 13.4637 16.0166 13.7135 15.8605C13.932 15.7044 14.0569 15.3922 13.9945 15.1112L13.1827 10.2719L16.6483 6.8375C16.8669 6.61895 16.9293 6.33795 16.8356 6.05696C16.742 5.80719 16.5234 5.58864 16.2424 5.55742L11.4655 4.83932L9.31126 0.4371Z" />
|
80
|
-
</svg>
|
33
|
+
const starCount = () => (
|
34
|
+
[...Array(Math.floor(rating))]
|
81
35
|
)
|
82
36
|
|
83
|
-
const
|
84
|
-
|
85
|
-
<path stroke={dark === true ? "$text_dk_lighter" : "#C1CDD6"} d="M5.91323 5.33377L6.17269 5.29477L6.28801 5.0591L8.44116 0.659187C8.49971 0.543364 8.59517 0.5 8.64884 0.5C8.74499 0.5 8.83506 0.555009 8.88775 0.659235L11.0409 5.0591L11.1562 5.29477L11.4157 5.33377L16.1925 6.05186L16.2021 6.0533L16.2117 6.05436C16.2359 6.05706 16.2671 6.06847 16.3024 6.09973C16.3374 6.13062 16.3686 6.17476 16.3886 6.22412C16.4186 6.32162 16.401 6.40181 16.3198 6.48332C16.3196 6.48353 16.3194 6.48374 16.3192 6.48394L12.8552 9.91671L12.6712 10.0991L12.7141 10.3546L13.5258 15.1939L13.528 15.2068L13.5308 15.2196C13.5488 15.3004 13.5074 15.402 13.4567 15.4462C13.3391 15.5132 13.2227 15.5096 13.1546 15.4781L8.88646 13.1726L8.64884 13.0443L8.41121 13.1726L4.14274 15.4782C4.07877 15.5083 3.99031 15.5147 3.87267 15.4466C3.82302 15.4033 3.76655 15.2914 3.77463 15.1781L4.61431 10.3577L4.65911 10.1005L4.47368 9.91671L1.0097 6.48394C1.00947 6.48372 1.00925 6.4835 1.00903 6.48327C0.927878 6.40178 0.910311 6.3216 0.94026 6.22412C0.960274 6.17476 0.99154 6.13062 1.02646 6.09973C1.0618 6.06847 1.09296 6.05706 1.11724 6.05436L1.12682 6.0533L1.13635 6.05186L5.91323 5.33377Z"/>
|
86
|
-
</svg>
|
37
|
+
const hasHalfStar = () => (
|
38
|
+
rating % 1 !== 0
|
87
39
|
)
|
88
40
|
|
89
41
|
return (
|
@@ -93,102 +45,53 @@ const StarRating = ({
|
|
93
45
|
className={css}
|
94
46
|
id={id}
|
95
47
|
>
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
<Caption
|
100
|
-
text={rating.toString()}
|
101
|
-
size="xs"
|
102
|
-
paddingRight="xs"
|
103
|
-
dark={dark}
|
104
|
-
/>
|
105
|
-
)}
|
106
|
-
{size === 'sm' && (
|
107
|
-
<Caption
|
108
|
-
text={rating.toString()}
|
109
|
-
size="xs"
|
110
|
-
paddingRight="xs"
|
111
|
-
dark={dark}
|
112
|
-
/>
|
113
|
-
)}
|
114
|
-
{size === 'md' && (
|
115
|
-
<Body
|
116
|
-
text={rating.toString()}
|
117
|
-
paddingRight="xs"
|
118
|
-
dark={dark}
|
119
|
-
/>
|
120
|
-
)}
|
121
|
-
{size === 'lg' && (
|
122
|
-
<Title
|
123
|
-
text={rating.toString()}
|
124
|
-
size={2}
|
125
|
-
paddingRight="sm"
|
126
|
-
dark={dark}
|
127
|
-
/>
|
128
|
-
)}
|
129
|
-
</div>
|
130
|
-
)}
|
131
|
-
<div className={`pb_star_rating_wrapper ${layoutOption}`}>
|
132
|
-
{[...Array(activeStars)].map((_, index) => (
|
133
|
-
<div className={`pb_star_${size}`} key={index}>
|
134
|
-
{colorOption === 'yellow' && (
|
135
|
-
starYellow
|
136
|
-
) }
|
137
|
-
{colorOption === 'primary' && (
|
138
|
-
starPrimary
|
139
|
-
) }
|
140
|
-
{colorOption === 'outline' && (
|
141
|
-
starPrimary
|
142
|
-
) }
|
143
|
-
{colorOption === 'subtle' && (
|
144
|
-
starSubtle
|
145
|
-
) }
|
146
|
-
</div>
|
147
|
-
))}
|
148
|
-
{[...Array(emptyStars)].map((_, index) => (
|
149
|
-
<div className={`pb_star_${size}`} key={index}>
|
150
|
-
{colorOption === 'outline' && (
|
151
|
-
starOutline
|
152
|
-
) }
|
153
|
-
{colorOption !== 'outline' && (
|
154
|
-
starBackground
|
155
|
-
) }
|
156
|
-
</div>
|
157
|
-
))}
|
48
|
+
{!hideRating && (
|
49
|
+
<div className="pb_star_rating_number">
|
50
|
+
{rating}
|
158
51
|
</div>
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
52
|
+
)}
|
53
|
+
<div className="pb_star_rating_wrapper">
|
54
|
+
<div className="pb_star_rating_highlight">
|
55
|
+
{starCount().map((_, index) => (
|
56
|
+
<Icon
|
57
|
+
fixedWidth={false}
|
58
|
+
icon="star"
|
59
|
+
key={index}
|
60
|
+
/>
|
61
|
+
))}
|
62
|
+
{hasHalfStar() && (
|
63
|
+
<Icon
|
64
|
+
fixedWidth={false}
|
65
|
+
icon="star-half"
|
66
|
+
/>
|
67
|
+
)}
|
68
|
+
</div>
|
69
|
+
|
70
|
+
<div className="pb_star_rating_base">
|
71
|
+
<Icon
|
72
|
+
fixedWidth={false}
|
73
|
+
icon="star"
|
74
|
+
/>
|
75
|
+
<Icon
|
76
|
+
fixedWidth={false}
|
77
|
+
icon="star"
|
78
|
+
/>
|
79
|
+
<Icon
|
80
|
+
fixedWidth={false}
|
81
|
+
icon="star"
|
82
|
+
/>
|
83
|
+
<Icon
|
84
|
+
fixedWidth={false}
|
85
|
+
icon="star"
|
86
|
+
/>
|
87
|
+
<Icon
|
88
|
+
fixedWidth={false}
|
89
|
+
icon="star"
|
90
|
+
/>
|
91
|
+
</div>
|
190
92
|
</div>
|
191
|
-
|
192
|
-
|
93
|
+
</div>
|
94
|
+
)
|
95
|
+
}
|
193
96
|
|
194
97
|
export default StarRating
|
@@ -2,22 +2,12 @@
|
|
2
2
|
|
3
3
|
<br>
|
4
4
|
|
5
|
-
<%= pb_rails("star_rating", props: { rating: 1 }) %>
|
6
|
-
|
7
|
-
<br>
|
8
|
-
|
9
|
-
<%= pb_rails("star_rating", props: { rating: 2}) %>
|
10
|
-
|
11
|
-
<br>
|
12
|
-
|
13
5
|
<%= pb_rails("star_rating", props: { rating: 3 }) %>
|
14
6
|
|
15
7
|
<br>
|
16
8
|
|
17
|
-
<%= pb_rails("star_rating", props: { rating:
|
9
|
+
<%= pb_rails("star_rating", props: { rating: 1.5 }) %>
|
18
10
|
|
19
11
|
<br>
|
20
12
|
|
21
13
|
<%= pb_rails("star_rating", props: { rating: 5 }) %>
|
22
|
-
|
23
|
-
<br>
|
@@ -4,21 +4,7 @@ import StarRating from '../_star_rating'
|
|
4
4
|
|
5
5
|
const StarRatingDefault = (props) => (
|
6
6
|
<>
|
7
|
-
<StarRating
|
8
|
-
|
9
|
-
<br />
|
10
|
-
|
11
|
-
<StarRating
|
12
|
-
rating={0.9}
|
13
|
-
{...props}
|
14
|
-
/>
|
15
|
-
|
16
|
-
<br />
|
17
|
-
|
18
|
-
<StarRating
|
19
|
-
rating={1.5}
|
20
|
-
{...props}
|
21
|
-
/>
|
7
|
+
<StarRating />
|
22
8
|
|
23
9
|
<br />
|
24
10
|
|
@@ -30,11 +16,10 @@ const StarRatingDefault = (props) => (
|
|
30
16
|
<br />
|
31
17
|
|
32
18
|
<StarRating
|
33
|
-
rating={
|
19
|
+
rating={1.5}
|
34
20
|
{...props}
|
35
21
|
/>
|
36
22
|
|
37
|
-
|
38
23
|
<br />
|
39
24
|
|
40
25
|
<StarRating
|