diff --git a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss
index d1ed6e11ab..c083ee2de7 100644
--- a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss
+++ b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss
@@ -3,6 +3,76 @@
@import "../tokens/opacity";
@import "../pb_avatar/avatar";
+$sizes: (
+ "avatar": ("sm": 38px, "md": 60px, "lg": 80px, "xl": 100px),
+ "first-item-double": ("sm": 20px, "md": 32px, "lg": 44px, "xl": 56px),
+ "first-item-triple": ("sm": 16px, "md": 24px, "lg": 32px, "xl": 44px),
+ "first-item-quadruple": ("sm": 16px, "md": 28px, "lg": 36px, "xl": 44px),
+ "second-item-double": ("sm": 12px, "md": 16px, "lg": 20px, "xl": 24px),
+ "second-item-triple": ("sm": 12px, "md": 20px, "lg": 24px, "xl": 32px),
+ "second-item-quadruple": ("sm": 12px, "md": 20px, "lg": 28px, "xl": 32px),
+ "third-item-triple": ("sm": 10px, "md": 16px, "lg": 20px, "xl": 24px),
+ "third-item-quadruple": ("sm": 10px, "md": 16px, "lg": 24px, "xl": 24px),
+ "fourth-item": ("sm": 8px, "md": 12px, "lg": 16px, "xl": 16px)
+);
+
+$positions: (
+ "second-item-double": (
+ "sm": ("top": null, "bottom": 5px, "right": 4px, "left": null),
+ "md": ("top": null, "bottom": 10px, "right": 8px, "left": null),
+ "lg": ("top": 46px, "bottom": null, "right": 12px, "left": null),
+ "xl": ("top": 58px, "bottom": null, "right": 14px, "left": null)
+ ),
+ "second-item-triple": (
+ "sm": ("top": 12px, "bottom": null, "right": 2px, "left": null),
+ "md": ("top": 24px, "bottom": null, "right": 5px, "left": null),
+ "lg": ("top": 32px, "bottom": null, "right": 9px, "left": null),
+ "xl": ("top": 41px, "bottom": null, "right": 11px, "left": null)
+ ),
+ "second-item-quadruple": (
+ "sm": ("top": null, "bottom": 9px, "right": 4px, "left": null),
+ "md": ("top": 24px, "bottom": null, "right": 5px, "left": null),
+ "lg": ("top": 31px, "bottom": null, "right": 6px, "left": null),
+ "xl": ("top": 43px, "bottom": null, "right": 9px, "left": null)
+ ),
+ "third-item-triple": (
+ "sm": ("top": null, "bottom": 3px, "right": null, "left": 11px),
+ "md": ("top": null, "bottom": 6px, "right": null, "left": 16px),
+ "lg": ("top": null, "bottom": 10px, "right": null, "left": 23px),
+ "xl": ("top": null, "bottom": 13px, "right": null, "left": 27px)
+ ),
+ "third-item-quadruple": (
+ "sm": ("top": null, "bottom": 3px, "right": null, "left": 9px),
+ "md": ("top": null, "bottom": 5px, "right": null, "left": 15px),
+ "lg": ("top": null, "bottom": 7px, "right": null, "left": 20px),
+ "xl": ("top": null, "bottom": 11px, "right": null, "left": 27px)
+ ),
+ "fourth-item": (
+ "sm": ("top": 5px, "bottom": null, "right": 6px, "left": null),
+ "md": ("top": 7px, "bottom": null, "right": 12px, "left": null),
+ "lg": ("top": 9px, "bottom": null, "right": 16px, "left": null),
+ "xl": ("top": 16px, "bottom": null, "right": 24px, "left": null)
+ ),
+ "first-item-double": (
+ "sm": ("top": 4px, "bottom": null, "right": null, "left": 3px),
+ "md": ("top": 6px, "bottom": null, "right": null, "left": 8px),
+ "lg": ("top": 8px, "bottom": null, "right": null, "left": 8px),
+ "xl": ("top": 10px, "bottom": null, "right": null, "left": 10px)
+ ),
+ "first-item-triple": (
+ "sm": ("top": 4px, "bottom": null, "right": null, "left": 4px),
+ "md": ("top": 7px, "bottom": null, "right": null, "left": 7px),
+ "lg": ("top": 10px, "bottom": null, "right": null, "left": 10px),
+ "xl": ("top": 12px, "bottom": null, "right": null, "left": 12px)
+ ),
+ "first-item-quadruple": (
+ "sm": ("top": 5px, "bottom": null, "right": null, "left": 3px),
+ "md": ("top": 7px, "bottom": null, "right": null, "left": 5px),
+ "lg": ("top": 9px, "bottom": null, "right": null, "left": 7px),
+ "xl": ("top": 16px, "bottom": null, "right": null, "left": 10px)
+ )
+);
+
@mixin avatar-size($size) {
height: $size;
width: $size;
@@ -27,8 +97,8 @@
$stacked_size: 18px;
$max_to_display: 1, 2;
display: inline-flex;
- width: $container_size;
- height: $container_size;
+ width: 28px;
+ height: 28px;
flex-basis: $container_size;
position: relative;
flex-shrink: 0;
@@ -48,7 +118,7 @@
}
}
&[class*=_single] .pb_multiple_users_stacked_item {
- @include avatar-size($container_size);
+ @include avatar-size(28px);
}
[class^=pb_avatar_kit].second_item, [class^=pb_badge_kit].second_item {
@include position((bottom: 0, right: 0));
@@ -71,72 +141,106 @@
color: transparent;
}
- &[class*=_bubble] {
- @include avatar-size($bubble_container_size);
- background-color: $bg_light;
- border-radius: 50%;
-
- &.dark {
- background-color: $card_dark;
- }
-
- [class^=pb_avatar_kit].pb_multiple_users_stacked_item {
- &.dark {
- .avatar_wrapper {
- border: $border_size solid $border_dark;
- }
- }
- }
-
- [class^=pb_avatar_kit] {
- &.first_item {
- @include position((top: 4px, left: 3px));
- @include avatar-size(20px);
-
- &.triple_bubble {
- @include position((top: 4px, left: 4px));
- @include avatar-size(16px);
+ // Iterate over each size to adjust the bubble container only when class contains "_bubble_"
+ @each $size_name, $size_value in $avatar-sizes {
+ &[class*=_bubble_][class*=_size_#{$size_name}] {
+ // Set bubble container size based on the class
+ $bubble_container_size: $size_value;
+ $container_size: $size_value;
+
+ // Apply the bubble container size
+ @include avatar-size($bubble_container_size);
+ width: $bubble_container_size;
+ height: $bubble_container_size;
+ flex-basis: $bubble_container_size;
+
+ background-color: $bg_light;
+ border-radius: 50%;
+
+ &.dark {
+ background-color: $card_dark;
}
-
- &.quadruple_bubble {
- @include position((top: 5px, left: 3px));
- @include avatar-size(16px);
- }
- }
-
- &.second_item {
- @include position((bottom: 5px, right: 4px));
- @include avatar-size(12px);
-
- &.triple_bubble {
- @include position((top: 13px, right: 2px));
+
+ [class^=pb_avatar_kit].pb_multiple_users_stacked_item {
+ @include avatar-size($bubble_container_size * 0.45); // Adjust the size of stacked avatars
+
+ &.dark {
+ .avatar_wrapper {
+ border: $border_size solid $border_dark;
+ }
+ }
+
+ .avatar_wrapper {
+ border: $border_size solid $white;
+ }
}
-
- &.quadruple_bubble {
- @include position((bottom: 9px, right: 4px));
+
+ [class^=pb_avatar_kit] {
+ // First Item
+ &.first_item {
+ @include position(map-get(map-get($positions, 'first-item-double'), $size_name));
+ @include avatar-size(map-get(map-get($sizes, 'first-item-double'), $size_name));
+
+ &.double_bubble {
+ @include position(map-get(map-get($positions, 'first-item-double'), $size_name));
+ @include avatar-size(map-get(map-get($sizes, 'first-item-double'), $size_name));
+ }
+
+ &.triple_bubble {
+ @include position(map-get(map-get($positions, 'first-item-triple'), $size_name));
+ @include avatar-size(map-get(map-get($sizes, 'first-item-triple'), $size_name));
+ }
+
+ &.quadruple_bubble {
+ @include position(map-get(map-get($positions, 'first-item-quadruple'), $size_name));
+ @include avatar-size(map-get(map-get($sizes, 'first-item-quadruple'), $size_name));
+ }
+ }
+
+ // Second Item
+ &.second_item {
+ @include position(map-get(map-get($positions, 'second-item-double'), $size_name));
+
+ &.double_bubble {
+ @include position(map-get(map-get($positions, 'second-item-double'), $size_name));
+ @include avatar-size(map-get(map-get($sizes, 'second-item-double'), $size_name));
+ }
+
+ &.triple_bubble {
+ @include position(map-get(map-get($positions, 'second-item-triple'), $size_name));
+ @include avatar-size(map-get(map-get($sizes, 'second-item-triple'), $size_name));
+ }
+
+ &.quadruple_bubble {
+ @include position(map-get(map-get($positions, 'second-item-quadruple'), $size_name));
+ @include avatar-size(map-get(map-get($sizes, 'second-item-quadruple'), $size_name));
+ }
+ }
+
+ // Third Item
+ &.third_item {
+ @include position(map-get(map-get($positions, 'third-item-triple'), $size_name));
+ @include avatar-size(map-get(map-get($sizes, 'third-item-triple'), $size_name));
+
+ &.quadruple_bubble {
+ @include position(map-get(map-get($positions, 'third-item-quadruple'), $size_name));
+ @include avatar-size(map-get(map-get($sizes, 'third-item-quadruple'), $size_name));
+ }
+ }
+
+ // Fourth Item
+ &.fourth_item {
+ @include position(map-get(map-get($positions, 'fourth-item'), $size_name));
+ @include avatar-size(map-get(map-get($sizes, 'fourth-item'), $size_name));
+ }
}
- }
-
- &.third_item {
- @include position((bottom: 3px, left: 11px));
- @include avatar-size(10px);
-
- &.quadruple_bubble {
- @include position((bottom: 3px, left: 9px));
+
+ &[class*=_single_bubble] {
+ [class^=pb_avatar_kit].first_item {
+ @include position((top: 0, left: 0));
+ @include avatar-size($bubble_container_size);
+ }
}
}
-
- &.fourth_item {
- @include position((top: 5px, right: 6px));
- @include avatar-size(8px);
- }
- }
- }
-
- &[class*=_single_bubble] {
- [class^=pb_avatar_kit].first_item {
- @include position((top: 0, left: 0));
- @include avatar-size($bubble_container_size);
}
}
-}
diff --git a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
index c347044725..37c7e10af3 100644
--- a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
+++ b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
@@ -81,7 +81,7 @@ const MultipleUsersStackedSingleBubble = () => {
test('should have a single bubble', () => {
render()
const kit = screen.getByTestId(testId)
- expect(kit).toHaveClass("pb_multiple_users_stacked_kit_single_bubble")
+ expect(kit).toHaveClass("pb_multiple_users_stacked_kit_single_bubble_size_sm")
const firstItem = kit.querySelector('.first_item');
expect(firstItem).toBeInTheDocument();
@@ -113,7 +113,7 @@ const MultipleUsersStackedDoubleBubble = () => {
test('should have a double bubble', () => {
render()
const kit = screen.getByTestId(testId)
- expect(kit).toHaveClass("pb_multiple_users_stacked_kit_bubble")
+ expect(kit).toHaveClass("pb_multiple_users_stacked_kit_bubble_size_sm")
const firstItem = kit.querySelector('.first_item');
expect(firstItem).toBeInTheDocument();
@@ -153,7 +153,7 @@ const MultipleUsersStackedTripleBubble = () => {
test('should have a triple bubble', () => {
render()
const kit = screen.getByTestId(testId)
- expect(kit).toHaveClass("pb_multiple_users_stacked_kit_bubble")
+ expect(kit).toHaveClass("pb_multiple_users_stacked_kit_bubble_size_sm")
const firstItem = kit.querySelector('.first_item');
expect(firstItem).toBeInTheDocument();
@@ -208,7 +208,7 @@ const MultipleUsersStackedQuadrupleBubble = () => {
test('should have a quadruple bubble', () => {
render()
const kit = screen.getByTestId(testId)
- expect(kit).toHaveClass("pb_multiple_users_stacked_kit_bubble")
+ expect(kit).toHaveClass("pb_multiple_users_stacked_kit_bubble_size_sm")
const firstItem = kit.querySelector('.first_item');
expect(firstItem).toBeInTheDocument();
@@ -224,4 +224,4 @@ test('should have a quadruple bubble', () => {
const fourthItem = kit.querySelector('.fourth_item');
expect(fourthItem).toBeInTheDocument();
-})
\ No newline at end of file
+})
diff --git a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx
index 1d71b974a5..79ab5d83ed 100644
--- a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx
+++ b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx
@@ -14,6 +14,7 @@ type MultipleUsersStackedProps = {
data?: { [key: string]: string },
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
id?: string,
+ size?: "md" | "lg" | "sm" | "xl"
users: Array<{ [key: string]: string }>,
variant: "default" | "bubble",
}
@@ -27,14 +28,17 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
htmlOptions = {},
id,
users,
+ size = "sm",
variant = "default",
} = props
const moreThanTwo = users.length > 2
const onlyOne = users.length == 1
const isBubble = variant === "bubble"
+ const doubleBubble = isBubble && users.length === 2
const tripleBubble = isBubble && users.length === 3
const quadrupleBubble = isBubble && users.length > 3
+ const sizeClass = isBubble ? `size_${size}` : ""
const displayCount = () => {
return moreThanTwo ? 1 : users.length
}
@@ -43,17 +47,19 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
const htmlProps = buildHtmlProps(htmlOptions)
const classes = classnames(buildCss(
'pb_multiple_users_stacked_kit',
- { single: onlyOne, bubble: isBubble }), globalProps(props), className)
+ { single: onlyOne, bubble: isBubble }, sizeClass),
+ globalProps(props),
+ className)
const firstUser = () => {
return users.slice(0, 1).map((userObject, index) => {
return (
)
})
@@ -65,10 +71,10 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
return (
)
})
@@ -81,10 +87,10 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
return (
)
})
@@ -97,10 +103,10 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
return (
)
})
diff --git a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.html.erb b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.html.erb
new file mode 100644
index 0000000000..f73fa21ee2
--- /dev/null
+++ b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.html.erb
@@ -0,0 +1,336 @@
+<%= pb_rails("title", props: {size: 4, text: "S", padding_top: "sm"}) %>
+
+<%= pb_rails("flex") do %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+
+ <%= pb_rails("multiple_users_stacked", props: {
+ variant: "bubble",
+ size: "sm",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ }
+ ]
+ }) %>
+
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "sm",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ }
+ ]
+ }) %>
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "sm",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ },
+ {
+ name: "Beverly Reyes",
+ image_url: "https://randomuser.me/api/portraits/women/74.jpg",
+ },
+ ]
+ }) %>
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "sm",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ },
+ {
+ name: "Beverly Reyes",
+ image_url: "https://randomuser.me/api/portraits/women/74.jpg",
+ },
+ {
+ name: "Keith Craig",
+ image_url: "https://randomuser.me/api/portraits/men/40.jpg",
+ },
+ {
+ name: "Alicia Cooper",
+ image_url: "https://randomuser.me/api/portraits/women/46.jpg",
+ }
+ ]
+ }) %>
+ <% end %>
+<% end %>
+
+
+
+<%= pb_rails("title", props: {size: 4, text: "M", padding_top: "sm"}) %>
+
+<%= pb_rails("flex") do %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "md",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ }
+ ]
+ }) %>
+
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "md",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ }
+ ]
+ }) %>
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "md",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ },
+ {
+ name: "Beverly Reyes",
+ image_url: "https://randomuser.me/api/portraits/women/74.jpg",
+ },
+ ]
+ }) %>
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "md",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ },
+ {
+ name: "Beverly Reyes",
+ image_url: "https://randomuser.me/api/portraits/women/74.jpg",
+ },
+ {
+ name: "Keith Craig",
+ image_url: "https://randomuser.me/api/portraits/men/40.jpg",
+ },
+ {
+ name: "Alicia Cooper",
+ image_url: "https://randomuser.me/api/portraits/women/46.jpg",
+ }
+ ]
+ }) %>
+ <% end %>
+<% end %>
+
+
+
+<%= pb_rails("title", props: {size: 4, text: "L", padding_top: "sm"}) %>
+
+<%= pb_rails("flex") do %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "lg",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ }
+ ]
+ }) %>
+
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "lg",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ }
+ ]
+ }) %>
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "lg",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ },
+ {
+ name: "Beverly Reyes",
+ image_url: "https://randomuser.me/api/portraits/women/74.jpg",
+ },
+ ]
+ }) %>
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "lg",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ },
+ {
+ name: "Beverly Reyes",
+ image_url: "https://randomuser.me/api/portraits/women/74.jpg",
+ },
+ {
+ name: "Keith Craig",
+ image_url: "https://randomuser.me/api/portraits/men/40.jpg",
+ },
+ {
+ name: "Alicia Cooper",
+ image_url: "https://randomuser.me/api/portraits/women/46.jpg",
+ }
+ ]
+ }) %>
+ <% end %>
+<% end %>
+
+
+<%= pb_rails("title", props: {size: 4, text: "XL", padding_top: "sm"}) %>
+
+<%= pb_rails("flex") do %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "xl",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ }
+ ]
+ }) %>
+
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "xl",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ }
+ ]
+ }) %>
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "xl",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ },
+ {
+ name: "Beverly Reyes",
+ image_url: "https://randomuser.me/api/portraits/women/74.jpg",
+ },
+ ]
+ }) %>
+ <% end %>
+ <%= pb_rails("flex/flex_item", props: { padding_right: "md" }) do %>
+ <%= pb_rails("multiple_users_stacked", props: {
+ size: "xl",
+ variant: "bubble",
+ users: [
+ {
+ name: "Patrick Welch",
+ image_url: "https://randomuser.me/api/portraits/men/9.jpg",
+ },
+ {
+ name: "Lucille Sanchez",
+ image_url: "https://randomuser.me/api/portraits/women/6.jpg",
+ },
+ {
+ name: "Beverly Reyes",
+ image_url: "https://randomuser.me/api/portraits/women/74.jpg",
+ },
+ {
+ name: "Keith Craig",
+ image_url: "https://randomuser.me/api/portraits/men/40.jpg",
+ },
+ {
+ name: "Alicia Cooper",
+ image_url: "https://randomuser.me/api/portraits/women/46.jpg",
+ }
+ ]
+ }) %>
+ <% end %>
+<% end %>
diff --git a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.jsx b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.jsx
new file mode 100644
index 0000000000..531f6e2de5
--- /dev/null
+++ b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.jsx
@@ -0,0 +1,97 @@
+import React from 'react'
+import Flex from '../../pb_flex/_flex'
+import Title from '../../pb_title/_title'
+import MultipleUsersStacked from '../_multiple_users_stacked'
+
+const MultipleUsersStackedSize = (props) => {
+ const sizes = [
+ { label: 'S', size: 'sm' },
+ { label: 'M', size: 'md' },
+ { label: 'L', size: 'lg' },
+ { label: 'XL', size: 'xl' },
+ ]
+
+ const usersList = [
+ [
+ {
+ name: 'Patrick Welch',
+ imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
+ },
+ ],
+ [
+ {
+ name: 'Patrick Welch',
+ imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
+ },
+ {
+ name: 'Lucille Sanchez',
+ imageUrl: 'https://randomuser.me/api/portraits/women/6.jpg',
+ },
+ ],
+ [
+ {
+ name: 'Patrick Welch',
+ imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
+ },
+ {
+ name: 'Lucille Sanchez',
+ imageUrl: 'https://randomuser.me/api/portraits/women/6.jpg',
+ },
+ {
+ name: 'Beverly Reyes',
+ imageUrl: 'https://randomuser.me/api/portraits/women/74.jpg',
+ },
+ ],
+ [
+ {
+ name: 'Patrick Welch',
+ imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
+ },
+ {
+ name: 'Lucille Sanchez',
+ imageUrl: 'https://randomuser.me/api/portraits/women/6.jpg',
+ },
+ {
+ name: 'Beverly Reyes',
+ imageUrl: 'https://randomuser.me/api/portraits/women/74.jpg',
+ },
+ {
+ name: 'Keith Craig',
+ imageUrl: 'https://randomuser.me/api/portraits/men/40.jpg',
+ },
+ {
+ name: 'Alicia Cooper',
+ imageUrl: 'https://randomuser.me/api/portraits/women/46.jpg',
+ },
+ ],
+ ]
+
+ return (
+ <>
+ {sizes.map(({ label, size }) => (
+
+ {label}
+
+ {usersList.map((users, index) => (
+
+
+
+ ))}
+
+
+
+ ))}
+ >
+ )
+}
+
+export default MultipleUsersStackedSize
diff --git a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml
index fde4f3211b..18b2112af3 100644
--- a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml
+++ b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml
@@ -3,11 +3,13 @@ examples:
rails:
- multiple_users_stacked_default: Default
- multiple_users_stacked_bubble: Bubble
+ - multiple_users_stacked_size: Sizes
react:
- multiple_users_stacked_default: Default
- multiple_users_stacked_bubble: Bubble
+ - multiple_users_stacked_size: Sizes
swift:
- multiple_users_stacked_default_swift: Default
diff --git a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js
index ec6c88a5e4..936773f536 100644
--- a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js
+++ b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js
@@ -1,2 +1,3 @@
export { default as MultipleUsersStackedDefault } from './_multiple_users_stacked_default.jsx'
export { default as MultipleUsersStackedBubble } from './_multiple_users_stacked_bubble.jsx'
+export { default as MultipleUsersStackedSize } from './_multiple_users_stacked_size.jsx'
diff --git a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb
index 1b004c88e9..3b94e94e71 100644
--- a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb
+++ b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb
@@ -1,5 +1,15 @@
<%= pb_content_tag do %>
- <%= pb_rails("avatar", props: object.users[0].merge({size: object.bubble ? "sm" : "xs", classname: "pb_multiple_users_stacked_item first_item#{object.triple_bubble ? " triple_bubble" : ""}#{object.quadruple_bubble ? " quadruple_bubble" : ""}", dark: object.dark}) ) %>
+ <%= pb_rails(
+ "avatar",
+ props: object.users[0].merge({
+ classname: "pb_multiple_users_stacked_item first_item" +
+ (object.double_bubble ? " double_bubble" : "") +
+ (object.triple_bubble ? " triple_bubble" : "") +
+ (object.quadruple_bubble ? " quadruple_bubble" : ""),
+ dark: object.dark,
+ size: 'xs'
+ })
+ ) %>
<% unless object.only_one %>
<% if object.more_than_two && !object.bubble %>
@@ -8,14 +18,26 @@
text: "+#{object.users.count - object.display_count}",
variant: "primary",
rounded: true,
- classname: "pb_multiple_users_stacked_item second_item" }) %>
+ classname: "pb_multiple_users_stacked_item second_item"
+ }) %>
<% elsif object.bubble %>
- <% object.users.slice(1,3).each_with_index do |item, idx| %>
- <%= pb_rails("avatar", props: item.merge({size: "xs", classname: "pb_multiple_users_stacked_item #{idx == 0 ? "second_item#{object.triple_bubble ? " triple_bubble" : ""}#{object.quadruple_bubble ? " quadruple_bubble" : ""}" : idx == 1 ? "third_item#{object.quadruple_bubble ? " quadruple_bubble" : ""}" : "fourth_item"}", dark: object.dark}) ) %>
+ <% object.users.slice(1, 3).each_with_index do |item, idx| %>
+ <%= pb_rails(
+ "avatar",
+ props: item.merge({
+ classname: object.bubble_classname(idx),
+ dark: object.dark
+ })
+ ) %>
<% end %>
<% else %>
- <%= pb_rails("avatar", props: object.users[1].merge({size: "xs", classname: "pb_multiple_users_stacked_item second_item", dark: object.dark}) ) %>
+ <%= pb_rails(
+ "avatar",
+ props: object.users[1].merge({
+ classname: "pb_multiple_users_stacked_item second_item",
+ dark: object.dark
+ })
+ ) %>
<% end %>
<% end %>
-
<% end %>
diff --git a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
index cc1be5dbf6..d7d7762dbf 100644
--- a/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
+++ b/playbook/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
@@ -4,6 +4,9 @@ module Playbook
module PbMultipleUsersStacked
class MultipleUsersStacked < Playbook::KitBase
prop :users, type: Playbook::Props::HashArray, required: true
+ prop :size, type: Playbook::Props::Enum,
+ values: %w[sm md lg xl],
+ default: "sm"
prop :variant, type: Playbook::Props::Enum,
values: %w[default bubble],
@@ -25,6 +28,10 @@ def bubble
variant == "bubble"
end
+ def double_bubble
+ bubble && users.count === 2
+ end
+
def triple_bubble
bubble && users.count === 3
end
@@ -33,8 +40,31 @@ def quadruple_bubble
bubble && users.count > 3
end
+ def size_class
+ "size_#{size}" if bubble
+ end
+
def classname
- generate_classname("pb_multiple_users_stacked_kit", single_class, bubble_class)
+ generate_classname("pb_multiple_users_stacked_kit", single_class, bubble_class, size_class)
+ end
+
+ def bubble_classname(index)
+ base_classname = "pb_multiple_users_stacked_item "
+
+ case index
+ when 0
+ base_classname += "second_item"
+ base_classname += " double_bubble" if double_bubble
+ base_classname += " triple_bubble" if triple_bubble
+ base_classname += " quadruple_bubble" if quadruple_bubble
+ when 1
+ base_classname += "third_item"
+ base_classname += " quadruple_bubble" if quadruple_bubble
+ else
+ base_classname += "fourth_item"
+ end
+
+ base_classname
end
private
diff --git a/playbook/spec/pb_kits/playbook/kits/multiple_users_stacked_spec.rb b/playbook/spec/pb_kits/playbook/kits/multiple_users_stacked_spec.rb
index 5e913d37cc..52d0d368a7 100644
--- a/playbook/spec/pb_kits/playbook/kits/multiple_users_stacked_spec.rb
+++ b/playbook/spec/pb_kits/playbook/kits/multiple_users_stacked_spec.rb
@@ -16,8 +16,8 @@
expect(subject.new(users: [{ name: "1", image_url: "1" }]).classname).to eq "pb_multiple_users_stacked_kit_single"
expect(subject.new(users: [], classname: "additional_class").classname).to eq "pb_multiple_users_stacked_kit additional_class"
expect(subject.new(users: [], dark: true).classname).to eq "pb_multiple_users_stacked_kit dark"
- expect(subject.new(users: [], variant: "bubble").classname).to eq "pb_multiple_users_stacked_kit_bubble"
- expect(subject.new(users: [{ name: "1", image_url: "1" }], variant: "bubble").classname).to eq "pb_multiple_users_stacked_kit_single_bubble"
+ expect(subject.new(users: [], variant: "bubble").classname).to eq "pb_multiple_users_stacked_kit_bubble_size_sm"
+ expect(subject.new(users: [{ name: "1", image_url: "1" }], variant: "bubble").classname).to eq "pb_multiple_users_stacked_kit_single_bubble_size_sm"
end
end