playbook_ui 14.12.0.pre.alpha.play1790darkaudittable5802 → 14.12.0.pre.alpha.play1830updateclassnamesdependency5888

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +9 -0
  3. data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +11 -7
  4. data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +6 -7
  5. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +9 -3
  6. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +6 -2
  7. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +11 -7
  8. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.html.erb +11 -0
  9. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.jsx +22 -0
  10. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_rails.md +1 -0
  11. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_react.md +1 -0
  12. data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +2 -0
  13. data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +1 -0
  14. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +11 -2
  15. data/app/pb_kits/playbook/pb_user/_user.tsx +3 -0
  16. data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.html.erb +42 -0
  17. data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.jsx +59 -0
  18. data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.md +2 -0
  19. data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
  20. data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
  21. data/app/pb_kits/playbook/pb_user/user.html.erb +1 -1
  22. data/app/pb_kits/playbook/pb_user/user.rb +1 -0
  23. data/app/pb_kits/playbook/pb_user/user.test.js +14 -0
  24. data/dist/chunks/{_typeahead-BIhRQo8Q.js → _typeahead-B4ApU9B7.js} +3 -3
  25. data/dist/chunks/{_weekday_stacked-CttHBFW3.js → _weekday_stacked-Cionc19j.js} +2 -2
  26. data/dist/chunks/vendor.js +1 -1
  27. data/dist/playbook-doc.js +1 -1
  28. data/dist/playbook-rails-react-bindings.js +1 -1
  29. data/dist/playbook-rails.js +1 -1
  30. data/dist/playbook.css +1 -1
  31. data/lib/playbook/version.rb +1 -1
  32. metadata +11 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 136b50dee766ec4667e6d2f602d111a863ce4020dd67fe561bf2778ebd060fb1
4
- data.tar.gz: 3ac4d8e93f62e1814d1ebe98fe4532239eb54370421b5bbad63503411d7639f7
3
+ metadata.gz: 545da62ea7493ab9eb8b1fc44a25b1c4b7f1274dd3e895a65d7a2faf35bcb31a
4
+ data.tar.gz: 60e1cbb5b349b92c05d66bb566cae8065df9fb20f2ac3102d1842eae5ad27204
5
5
  SHA512:
6
- metadata.gz: e07d993618ba3291e460247bfae535f6725c3563a10bc58e4ac90bcedb436088f73c6c979114ca381f060bc222dd640b32cd66bb0fd91d6a6a8c298f26eb3d64
7
- data.tar.gz: 98ffa30e5b69b4759356a445a308eb9858522f206df9dff83b142e92bc75376d60235719d777702a3185ecbb2a51c2c2f7b64a7998325482f607feab9e249c61
6
+ metadata.gz: 3ab3204959166378716948935d9e64619dd5e141a18fa95337e0074e24e879128c1dcbfb76c1d028330ba7c902993319b3454d486716778dfc828100140ad530
7
+ data.tar.gz: 49ea0a8cc8f4a1e94103001bf954bb7f0792d8358aad451814e498b417f8a8ab7d7d64cd050418a295b5ea3a8c50805314dedc545090c02d97fca1e3aabca52a
@@ -27,6 +27,9 @@ $avatar-sizes: (
27
27
  flex-basis: $size;
28
28
 
29
29
  & > [class^=pb_flex_kit] {
30
+ [class^=pb_card_kit] {
31
+ padding: 2px;
32
+ }
30
33
  [class^=pb_card_kit].overlay_bottom_center,
31
34
  [class^=pb_card_kit].overlay_top_center {
32
35
  left: 50%;
@@ -52,6 +55,10 @@ $avatar-sizes: (
52
55
  flex-grow: 0;
53
56
  flex-basis: $size;
54
57
 
58
+ .dark & {
59
+ background: $text_dk_light;
60
+ }
61
+
55
62
  &::before {
56
63
  content: attr(data-initials);
57
64
  width: 100%;
@@ -78,9 +85,11 @@ $avatar-sizes: (
78
85
  }
79
86
  }
80
87
  }
88
+
81
89
  &.dark {
82
90
  [class^=pb_card_kit] {
83
91
  position: absolute;
92
+ padding: 2px;
84
93
  }
85
94
  }
86
95
  }
@@ -23,8 +23,8 @@ export type AvatarProps = {
23
23
  variant?: string,
24
24
  icon?: string
25
25
  },
26
- data?: {[key: string]: string},
27
26
  dark?: boolean,
27
+ data?: {[key: string]: string},
28
28
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
29
29
  id?: string,
30
30
  imageAlt?: string,
@@ -71,13 +71,13 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
71
71
 
72
72
  const canShowImage = imageUrl && !error
73
73
 
74
- const onlineStatusSize =
74
+ const onlineStatusSize =
75
75
  ['xxs', 'xs'].includes(size) ? 'sm' :
76
76
  ['sm', 'md'].includes(size) ? 'md' :
77
77
  ['lg', 'xl'].includes(size) ? 'lg' :
78
78
  'sm';
79
79
 
80
- const onlineStatusPositionProps = (["xxs", "xs", "sm"].includes(size)) ?
80
+ const onlineStatusPositionProps = (["xxs", "xs", "sm"].includes(size)) ?
81
81
  {
82
82
  top: { inset: true, value: "0" },
83
83
  right: { inset: false, value: "xxs" }
@@ -96,10 +96,10 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
96
96
  id={id}
97
97
  >
98
98
  {componentOverlay ? (
99
- <Flex display="display_inline_block"
99
+ <Flex display="display_inline_block"
100
100
  position="relative"
101
101
  >
102
- <div className="avatar_wrapper"
102
+ <div className="avatar_wrapper"
103
103
  data-initials={initials}
104
104
  >
105
105
  {canShowImage && (
@@ -115,12 +115,14 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
115
115
  <Card
116
116
  borderNone
117
117
  borderRadius="rounded"
118
+ dark={dark}
118
119
  padding="none"
119
120
  position="absolute"
120
121
  {...getPlacementProps(componentOverlay.placement, size)}
121
122
  >
122
-
123
+
123
124
  <Badge
125
+ dark={dark}
124
126
  rounded
125
127
  text={componentOverlay.text}
126
128
  variant={componentOverlay.variant as "error" | "info" | "neutral" | "primary" | "success" | "warning" | "notification"}
@@ -131,11 +133,13 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
131
133
  <Card
132
134
  borderNone
133
135
  borderRadius="rounded"
136
+ dark={dark}
134
137
  htmlOptions={{style: {padding:"2px"}}}
135
138
  position="absolute"
136
139
  {...getPlacementProps(componentOverlay.placement, size)}
137
140
  >
138
141
  <IconCircle
142
+ dark={dark}
139
143
  icon={componentOverlay.icon}
140
144
  size="xxs"
141
145
  variant={componentOverlay.variant as "default" | "royal" | "blue" | "purple" | "teal" | "red" | "yellow" | "orange" | "green"}
@@ -145,7 +149,7 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
145
149
  </Flex>
146
150
  ) : (
147
151
  <>
148
- <div className="avatar_wrapper"
152
+ <div className="avatar_wrapper"
149
153
  data-initials={initials}
150
154
  >
151
155
  {canShowImage && (
@@ -1,22 +1,22 @@
1
1
 
2
2
  <%= object.pb_content_tag(:div, data: object.data.merge(initials: object.initials)) do %>
3
3
  <% if object.component_overlay && object.component_overlay[:component] == "icon_circle" %>
4
- <%= pb_rails("flex", props: {display: "display_inline_block", position: "relative" }) do %>
4
+ <%= pb_rails("flex", props: { display: "display_inline_block", position: "relative" }) do %>
5
5
  <%= content_tag(:div, data: { initials: object.initials }, class: "avatar_wrapper") do %>
6
6
  <%= pb_rails("image", props: { alt: object.alt_text, url: object.image_url, on_error: object.handle_img_error }) if object.image_url.present? %>
7
7
  <% end %>
8
- <%= pb_rails("card", props: { border_none: true, border_radius: "rounded", html_options: { style: "padding: 2px" }, position: "absolute" }.merge(specific_placement_style)) do %>
8
+ <%= pb_rails("card", props: { border_none: true, border_radius: "rounded", dark: object.dark, position: "absolute" }.merge(specific_placement_style)) do %>
9
9
 
10
- <%= pb_rails("icon_circle", props: { size: "xxs", icon: object.component_overlay[:icon], variant: object.component_overlay[:variant] }) %>
10
+ <%= pb_rails("icon_circle", props: { dark: object.dark, size: "xxs", icon: object.component_overlay[:icon], variant: object.component_overlay[:variant] }) %>
11
11
  <% end %>
12
12
  <% end %>
13
13
  <% elsif object.component_overlay && object.component_overlay[:component] == "badge" %>
14
- <%= pb_rails("flex", props: {display: "display_inline_block", position: "relative" }) do %>
14
+ <%= pb_rails("flex", props: { display: "display_inline_block", position: "relative" }) do %>
15
15
  <%= content_tag(:div, data: { initials: object.initials }, class: "avatar_wrapper") do %>
16
16
  <%= pb_rails("image", props: { alt: object.alt_text, url: object.image_url, on_error: object.handle_img_error }) if object.image_url.present? %>
17
17
  <% end %>
18
- <%= pb_rails("card", props: { border_none: true, border_radius: "rounded", padding: "none", position: "absolute" }.merge(specific_placement_style)) do %>
19
- <%= pb_rails("badge", props: { rounded: true, text: object.component_overlay[:text], variant: object.component_overlay[:variant] }) %>
18
+ <%= pb_rails("card", props: { border_none: true, border_radius: "rounded", dark: object.dark, padding: "none", position: "absolute" }.merge(specific_placement_style)) do %>
19
+ <%= pb_rails("badge", props: { dark: object.dark, rounded: true, text: object.component_overlay[:text], variant: object.component_overlay[:variant] }) %>
20
20
  <% end %>
21
21
  <% end %>
22
22
  <% else %>
@@ -26,4 +26,3 @@
26
26
  <%= pb_rails("online_status", props: object.online_status_props) if object.status %>
27
27
  <% end %>
28
28
  <% end %>
29
-
@@ -1,18 +1,19 @@
1
1
  import React from "react";
2
2
  import { Avatar } from 'playbook-ui'
3
3
 
4
- const AvatarBadgeComponentOverlay = () => {
4
+ const AvatarBadgeComponentOverlay = (props) => {
5
5
  return (
6
6
  <div>
7
7
  <Avatar
8
8
  componentOverlay={{
9
9
  component: "badge",
10
10
  placement: "bottom-right",
11
- text: "12"
11
+ text: "12",
12
12
  }}
13
13
  imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
14
14
  marginBottom="sm"
15
15
  size="sm"
16
+ {...props}
16
17
  />
17
18
 
18
19
  <Avatar
@@ -24,6 +25,8 @@ const AvatarBadgeComponentOverlay = () => {
24
25
  imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
25
26
  marginBottom="sm"
26
27
  size="md"
28
+ {...props}
29
+
27
30
  />
28
31
 
29
32
  <Avatar
@@ -36,6 +39,8 @@ const AvatarBadgeComponentOverlay = () => {
36
39
  imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
37
40
  marginBottom="sm"
38
41
  size="lg"
42
+ {...props}
43
+
39
44
  />
40
45
 
41
46
  <Avatar
@@ -48,7 +53,8 @@ const AvatarBadgeComponentOverlay = () => {
48
53
  imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
49
54
  marginBottom="sm"
50
55
  size="xl"
51
- />
56
+ {...props}
57
+ />
52
58
  </div>
53
59
  )
54
60
  }
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { Avatar } from 'playbook-ui'
3
3
 
4
- const AvatarCircleIconComponentOverlay = () => {
4
+ const AvatarCircleIconComponentOverlay = (props) => {
5
5
  return (
6
6
  <div>
7
7
  <Avatar
@@ -14,6 +14,7 @@ const AvatarCircleIconComponentOverlay = () => {
14
14
  imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
15
15
  marginBottom="sm"
16
16
  size="sm"
17
+ {...props}
17
18
  />
18
19
 
19
20
  <Avatar
@@ -26,6 +27,7 @@ const AvatarCircleIconComponentOverlay = () => {
26
27
  imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
27
28
  marginBottom="sm"
28
29
  size="md"
30
+ {...props}
29
31
  />
30
32
 
31
33
  <Avatar
@@ -38,6 +40,7 @@ const AvatarCircleIconComponentOverlay = () => {
38
40
  imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
39
41
  marginBottom="sm"
40
42
  size="lg"
43
+ {...props}
41
44
  />
42
45
 
43
46
  <Avatar
@@ -50,7 +53,8 @@ const AvatarCircleIconComponentOverlay = () => {
50
53
  imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
51
54
  marginBottom="sm"
52
55
  size="xl"
53
- />
56
+ {...props}
57
+ />
54
58
  </div>
55
59
  )
56
60
  }
@@ -18,6 +18,7 @@ type HomeAddressStreetProps = {
18
18
  className?: string,
19
19
  data?: { [key: string]: string },
20
20
  dark?: boolean,
21
+ preserveCase?: boolean,
21
22
  emphasis: "street" | "city" | "none",
22
23
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
23
24
  homeId: string,
@@ -43,6 +44,7 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
43
44
  htmlOptions = {},
44
45
  homeId,
45
46
  homeUrl,
47
+ preserveCase = false,
46
48
  target,
47
49
  newWindow,
48
50
  houseStyle,
@@ -77,6 +79,8 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
77
79
  return null
78
80
  }
79
81
 
82
+ const formatStreetAdr = (address: string): string => preserveCase ? address : titleize(address)
83
+
80
84
  return (
81
85
  <div
82
86
  className={classes(className, dark)}
@@ -91,7 +95,7 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
91
95
  dark={dark}
92
96
  size={4}
93
97
  >
94
- {joinPresent([titleize(address), houseStyle], ' · ')}
98
+ {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
95
99
  </Title>
96
100
  <Title
97
101
  className="pb_home_address_street_address"
@@ -101,14 +105,14 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
101
105
  {titleize(addressCont)}
102
106
  </Title>
103
107
  <Body color="light">
104
- {`${titleize(city)}, ${state} ${zipcode}`}
108
+ {`${titleize(city)}, ${state.toUpperCase()} ${zipcode}`}
105
109
  </Body>
106
110
  </div>
107
111
  }
108
112
  {emphasis == 'city' &&
109
113
  <div>
110
114
  <Body color="light">
111
- {joinPresent([titleize(address), houseStyle], ' · ')}
115
+ {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
112
116
  </Body>
113
117
  <Body color="light">{titleize(addressCont)}</Body>
114
118
  <div>
@@ -118,7 +122,7 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
118
122
  size={4}
119
123
  tag="span"
120
124
  >
121
- {`${titleize(city)}, ${state}`}
125
+ {`${titleize(city)}, ${state.toUpperCase()}`}
122
126
  </Title>
123
127
  <Body
124
128
  color="light"
@@ -132,15 +136,15 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
132
136
  {emphasis == 'none' &&
133
137
  <div>
134
138
  <Body dark={dark}>
135
- {joinPresent([titleize(address), houseStyle], ' · ')}
139
+ {joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
136
140
  </Body>
137
- <Body dark={dark}>{titleize(addressCont)}</Body>
141
+ <Body dark={dark}>{formatStreetAdr(addressCont)}</Body>
138
142
  <div>
139
143
  <Body
140
144
  color="light"
141
145
  dark={dark}
142
146
  >
143
- {`${titleize(city)}, ${state} ${zipcode}`}
147
+ {`${titleize(city)}, ${state.toUpperCase()} ${zipcode}`}
144
148
  </Body>
145
149
  </div>
146
150
  </div>
@@ -0,0 +1,11 @@
1
+ <%= pb_rails("home_address_street", props: {
2
+ address: "70 pRoSpEcT ave",
3
+ address_cont: "Apt M18",
4
+ city: "West Chester",
5
+ home_id: 8250263,
6
+ home_url: "https://powerhrg.com/",
7
+ preserve_case: true,
8
+ state: "pa",
9
+ zipcode: "19382",
10
+ territory: "PHL",
11
+ }) %>
@@ -0,0 +1,22 @@
1
+ import React from 'react'
2
+
3
+ import HomeAddressStreet from '../_home_address_street'
4
+
5
+ const HomeAddressStreetFormatting = (props) => {
6
+ return (
7
+ <HomeAddressStreet
8
+ address="70 pRoSpEcT ave"
9
+ addressCont="Apt M18"
10
+ city="West Chester"
11
+ homeId="8250263"
12
+ homeUrl="https://powerhrg.com/"
13
+ preserveCase
14
+ state="pa"
15
+ territory="PHL"
16
+ zipcode="19382"
17
+ {...props}
18
+ />
19
+ )
20
+ }
21
+
22
+ export default HomeAddressStreetFormatting
@@ -0,0 +1 @@
1
+ The `state` prop will always capitalize the state name, even if the data entered is in lowercase. For example, when `state="pa"` is passed, it will be rendered as "PA". When you pass `preserve_case: true`, the street address will be rendered exactly as entered, without automatic title capitalization.
@@ -0,0 +1 @@
1
+ The `state` prop will always capitalize the state name, even if the data entered is in lowercase. For example, when `state="pa"` is passed, it will be rendered as "PA". When you pass `preserveCase`, the street address will be rendered exactly as entered, without automatic title capitalization.
@@ -5,12 +5,14 @@ examples:
5
5
  - home_address_street_emphasis: Emphasis
6
6
  - home_address_street_modified: Modified
7
7
  - home_address_street_link: Link
8
+ - home_address_street_formatting: Formatting
8
9
 
9
10
  react:
10
11
  - home_address_street_default: Default
11
12
  - home_address_street_emphasis: Emphasis
12
13
  - home_address_street_modified: Modified
13
14
  - home_address_street_link: Link
15
+ - home_address_street_formatting: Formatting
14
16
 
15
17
  swift:
16
18
  - home_address_street_default_swift: Default
@@ -2,3 +2,4 @@ export { default as HomeAddressStreetDefault } from './_home_address_street_defa
2
2
  export { default as HomeAddressStreetEmphasis } from './_home_address_street_emphasis.jsx'
3
3
  export { default as HomeAddressStreetModified } from './_home_address_street_modified.jsx'
4
4
  export { default as HomeAddressStreetLink } from './_home_address_street_link.jsx'
5
+ export { default as HomeAddressStreetFormatting } from './_home_address_street_formatting.jsx'
@@ -18,6 +18,7 @@ module Playbook
18
18
  prop :state
19
19
  prop :zipcode
20
20
  prop :territory
21
+ prop :preserve_case, default: false
21
22
  prop :dark, type: Playbook::Props::Boolean, default: false
22
23
 
23
24
  def classname
@@ -29,7 +30,7 @@ module Playbook
29
30
  end
30
31
 
31
32
  def city_state
32
- [city&.titleize, state].join(", ")
33
+ [city&.titleize, state&.upcase].join(", ")
33
34
  end
34
35
 
35
36
  def zip
@@ -37,7 +38,7 @@ module Playbook
37
38
  end
38
39
 
39
40
  def address_house_style
40
- [address&.titleize, house_style].join(separator)
41
+ [format_street_address, house_style].join(separator)
41
42
  end
42
43
 
43
44
  def address_house_style2
@@ -48,6 +49,14 @@ module Playbook
48
49
  house_style ? " \u00b7 " : ""
49
50
  end
50
51
 
52
+ def format_street_address
53
+ preserve_case ? address : custom_titleize(address)
54
+ end
55
+
56
+ def custom_titleize(str)
57
+ str.split(" ").map(&:capitalize).join(" ")
58
+ end
59
+
51
60
  def city_emphasis_props
52
61
  {
53
62
  address_house_style: address_house_style,
@@ -13,6 +13,7 @@ type UserProps = {
13
13
  aria?: {[key: string]: string},
14
14
  avatar?: boolean,
15
15
  avatarUrl?: string,
16
+ bold?: boolean,
16
17
  className?: string,
17
18
  dark?: boolean,
18
19
  data?: {[key: string]: string},
@@ -32,6 +33,7 @@ const User = (props: UserProps): React.ReactElement => {
32
33
  aria = {},
33
34
  avatar = false,
34
35
  avatarUrl,
36
+ bold = true,
35
37
  className,
36
38
  dark = false,
37
39
  data = {},
@@ -75,6 +77,7 @@ const User = (props: UserProps): React.ReactElement => {
75
77
  }
76
78
  <div className="content_wrapper">
77
79
  <Title
80
+ bold={bold}
78
81
  dark={dark}
79
82
  size={size == 'lg' ? 3 : 4}
80
83
  text={name}
@@ -0,0 +1,42 @@
1
+ <div class="pb--doc-demo-row">
2
+ <div>
3
+ <%= pb_rails("user", props: {
4
+ name: "Anna Black",
5
+ title: "Remodeling Consultant",
6
+ orientation: "vertical",
7
+ align: "center",
8
+ size: "lg",
9
+ avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
10
+ bold: false
11
+ }) %>
12
+ </div>
13
+ <div>
14
+ <%= pb_rails("user", props: {
15
+ name: "Anna Black",
16
+ title: "Remodeling Consultant",
17
+ orientation: "horizontal",
18
+ align: "left",
19
+ avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
20
+ bold: false
21
+ }) %>
22
+ </div>
23
+ <div>
24
+ <%= pb_rails("user", props: {
25
+ name: "Anna Black",
26
+ orientation: "horizontal",
27
+ align: "left",
28
+ avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
29
+ bold: false
30
+ }) %>
31
+
32
+ <br>
33
+
34
+ <%= pb_rails("user", props: {
35
+ name: "Anna Black",
36
+ orientation: "horizontal",
37
+ align: "left",
38
+ avatar: true,
39
+ bold: false
40
+ }) %>
41
+ </div>
42
+ </div>
@@ -0,0 +1,59 @@
1
+ import React from 'react'
2
+ import { User } from 'playbook-ui'
3
+
4
+ const UserLightWeight = (props) => {
5
+ return (
6
+ <div className="pb--doc-demo-row">
7
+
8
+ <div>
9
+ <User
10
+ align="center"
11
+ avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
12
+ bold={false}
13
+ name="Anna Black"
14
+ orientation="vertical"
15
+ size="lg"
16
+ title="Remodeling Consultant"
17
+ {...props}
18
+ />
19
+ </div>
20
+
21
+ <div>
22
+ <User
23
+ align="left"
24
+ avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
25
+ bold={false}
26
+ name="Anna Black"
27
+ orientation="horizontal"
28
+ title="Remodeling Consultant"
29
+ {...props}
30
+ />
31
+ </div>
32
+
33
+ <div>
34
+ <User
35
+ align="left"
36
+ avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
37
+ bold={false}
38
+ name="Anna Black"
39
+ orientation="horizontal"
40
+ {...props}
41
+ />
42
+
43
+ <br />
44
+
45
+ <User
46
+ align="left"
47
+ avatar
48
+ bold={false}
49
+ name="Anna Black"
50
+ orientation="horizontal"
51
+ {...props}
52
+ />
53
+ </div>
54
+
55
+ </div>
56
+ )
57
+ }
58
+
59
+ export default UserLightWeight
@@ -0,0 +1,2 @@
1
+ ##### Prop
2
+ Name will use `font-weight: 700` by default, if you want a lighter font weight, use the `bold` prop set to `false`. Name will then use `font-weight: 300`.
@@ -2,6 +2,7 @@ examples:
2
2
 
3
3
  rails:
4
4
  - user_default: Default
5
+ - user_light_weight: Light Weight
5
6
  - user_with_territory: With Territory
6
7
  - user_text_only: Text Only
7
8
  - user_size: Horizontal Size
@@ -11,6 +12,7 @@ examples:
11
12
 
12
13
  react:
13
14
  - user_default: Default
15
+ - user_light_weight: Light Weight
14
16
  - user_with_territory: With Territory
15
17
  - user_text_only: Text Only
16
18
  - user_size: Horizontal Size
@@ -1,4 +1,5 @@
1
1
  export { default as UserDefault } from './_user_default.jsx'
2
+ export { default as UserLightWeight } from './_user_light_weight.jsx'
2
3
  export { default as UserWithTerritory } from './_user_with_territory.jsx'
3
4
  export { default as UserTextOnly } from './_user_text_only.jsx'
4
5
  export { default as UserSize } from './_user_size.jsx'
@@ -12,7 +12,7 @@
12
12
  }) %>
13
13
  <% end %>
14
14
  <%= content_tag(:div, class: "content_wrapper") do %>
15
- <%= pb_rails("title", props: { text: object.name, size: object.title_size, dark: object.dark }) %>
15
+ <%= pb_rails("title", props: { text: object.name, size: object.title_size, dark: object.dark, bold: object.bold }) %>
16
16
  <%= pb_rails("body", props: {
17
17
  text: "#{object.details}",
18
18
  dark: object.dark,
@@ -9,6 +9,7 @@ module Playbook
9
9
  prop :avatar, type: Playbook::Props::Boolean,
10
10
  default: false
11
11
  prop :avatar_url
12
+ prop :bold, type: Playbook::Props::Boolean, default: true
12
13
  prop :name
13
14
  prop :orientation, type: Playbook::Props::Enum,
14
15
  values: %w[vertical horizontal],
@@ -26,3 +26,17 @@ test('subtitle prop accepts a node', () => {
26
26
 
27
27
  expect(screen.getByTestId('test-subtitle-block')).toHaveTextContent('test caption')
28
28
  })
29
+
30
+ test('bold prop applies correct styling when false', () => {
31
+ render(
32
+ <User
33
+ bold={false}
34
+ data={{ testid: 'test-bold-false' }}
35
+ name="Anna Black"
36
+ />
37
+ )
38
+ const titleElement = screen.getByText("Anna Black")
39
+ expect(titleElement).toBeInTheDocument()
40
+
41
+ expect(titleElement).toHaveClass('pb_title_kit_size_4_thin')
42
+ })