diff --git a/playbook/app/pb_kits/playbook/pb_avatar/_avatar.jsx b/playbook/app/pb_kits/playbook/pb_avatar/_avatar.jsx index b028814151..251219e7b7 100755 --- a/playbook/app/pb_kits/playbook/pb_avatar/_avatar.jsx +++ b/playbook/app/pb_kits/playbook/pb_avatar/_avatar.jsx @@ -44,7 +44,7 @@ const Avatar = (props: AvatarProps) => { const dataProps = buildDataProps(data) const ariaProps = buildAriaProps(aria) const classes = classnames( - buildCss('pb_avatar_kit', size), + buildCss('pb_avatar_kit', `size_${size}`), globalProps(props), className ) diff --git a/playbook/app/pb_kits/playbook/pb_avatar/_avatar.scss b/playbook/app/pb_kits/playbook/pb_avatar/_avatar.scss index fce1f2a4ed..0eacd32bb3 100755 --- a/playbook/app/pb_kits/playbook/pb_avatar/_avatar.scss +++ b/playbook/app/pb_kits/playbook/pb_avatar/_avatar.scss @@ -16,8 +16,8 @@ $avatar-sizes: ( position: relative; @each $name, $size in $avatar-sizes { - &[class*=_#{$name}], - &[class*=_#{$name}_thumb] { + &[class*=_size_#{$name}], + &[class*=_size_#{$name}_thumb] { width: $size; height: $size; object-fit: cover; diff --git a/playbook/app/pb_kits/playbook/pb_avatar/avatar.rb b/playbook/app/pb_kits/playbook/pb_avatar/avatar.rb index 960ce19f75..07955aaac0 100755 --- a/playbook/app/pb_kits/playbook/pb_avatar/avatar.rb +++ b/playbook/app/pb_kits/playbook/pb_avatar/avatar.rb @@ -18,7 +18,7 @@ def initials end def classname - generate_classname("pb_avatar_kit", size) + generate_classname("pb_avatar_kit", "size_#{size}") end def online_status_props diff --git a/playbook/app/pb_kits/playbook/pb_avatar/avatar.test.js b/playbook/app/pb_kits/playbook/pb_avatar/avatar.test.js index a5bcc7252b..74d85a3a92 100644 --- a/playbook/app/pb_kits/playbook/pb_avatar/avatar.test.js +++ b/playbook/app/pb_kits/playbook/pb_avatar/avatar.test.js @@ -22,7 +22,7 @@ test('loads the given image url and name', () => { const image = screen.getByAltText(imageAlt) const initials = name.split(/\s/)[0].substr(0, 1) + name.split(/\s/)[1].substr(0, 1) - expect(kit).toHaveClass('pb_avatar_kit_md') + expect(kit).toHaveClass('pb_avatar_kit_size_md') expect(kit).toHaveAttribute('data-initials', initials) expect(image).toHaveAttribute('data-src', imageUrl) expect(image).toHaveAttribute('src', imageUrl) diff --git a/playbook/spec/pb_kits/playbook/kits/avatar_spec.rb b/playbook/spec/pb_kits/playbook/kits/avatar_spec.rb index e4077ac4fb..b75e611bc3 100644 --- a/playbook/spec/pb_kits/playbook/kits/avatar_spec.rb +++ b/playbook/spec/pb_kits/playbook/kits/avatar_spec.rb @@ -19,9 +19,9 @@ } describe "#classname" do it "returns namespaced class name", :aggregate_failures do - expect(subject.new({}).classname).to eq "pb_avatar_kit_md" - expect(subject.new(classname: "additional_class").classname).to eq "pb_avatar_kit_md additional_class" - expect(subject.new(size: "lg").classname).to eq "pb_avatar_kit_lg" + expect(subject.new({}).classname).to eq "pb_avatar_kit_size_md" + expect(subject.new(classname: "additional_class").classname).to eq "pb_avatar_kit_size_md additional_class" + expect(subject.new(size: "lg").classname).to eq "pb_avatar_kit_size_lg" end end end