Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[PLAY-112] Size Prop styling needs to be corrected: Image Kit #1756

Merged
merged 1 commit into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion playbook/app/pb_kits/playbook/pb_image/_image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Image = (props: ImageProps) => {

const ariaProps = buildAriaProps(aria)
const classes = classnames(
buildCss('pb_image_kit', size),
buildCss('pb_image_kit', size ? `size_${size}` : null),
'lazyload',
transition,
{ rounded },
Expand Down
6 changes: 3 additions & 3 deletions playbook/app/pb_kits/playbook/pb_image/_image.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $image-sizes: (
object-fit: cover;

@each $name, $size in $image-sizes {
&[class*=_#{$name}] {
&[class*=size_#{$name}] {
width: $size;
height: $size;
object-fit: cover;
Expand All @@ -35,7 +35,7 @@ $image-sizes: (
transition: opacity 300ms ease-in;
}
}

&.blur {
filter: blur(5px);
&.lazyloaded {
Expand All @@ -44,7 +44,7 @@ $image-sizes: (
transition: filter 300ms ease-in;
}
}

&.scale {
opacity: 0;
transform: scale(0.9);
Expand Down
2 changes: 1 addition & 1 deletion playbook/app/pb_kits/playbook/pb_image/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def rounded_class
end

def size_class
size == "none" ? nil : "_#{size}"
size == "none" ? nil : "_size_#{size}"
end

def transition_class
Expand Down
2 changes: 1 addition & 1 deletion playbook/app/pb_kits/playbook/pb_image/image.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test('default classname', () => {

test('size = xs', () => {
const kit = renderKit(Image, props, { size: 'xs' })
expect(kit).toHaveClass('pb_image_kit_xs lazyload')
expect(kit).toHaveClass('pb_image_kit_size_xs lazyload')
})

test('transition = blur', () => {
Expand Down
2 changes: 1 addition & 1 deletion playbook/spec/pb_kits/playbook/kits/image_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
describe "#classname" do
it "returns namespaced class name", :aggregate_failures do
expect(subject.new({}).classname).to eq "pb_image_kit fade lazyload"
expect(subject.new({ size: "xs" }).classname).to eq "pb_image_kit_xs fade lazyload"
expect(subject.new({ size: "xs" }).classname).to eq "pb_image_kit_size_xs fade lazyload"
expect(subject.new({ rounded: true }).classname).to eq "pb_image_kit fade lazyload rounded"
end
end
Expand Down