patternfly-org icon indicating copy to clipboard operation
patternfly-org copied to clipboard

Images are presented inconsistently in docs

Open mcoker opened this issue 2 months ago • 3 comments

Curious if we could normalize any of these. I'll also say that on top of these, there are a lot of images in the docs that are not within any kind of class/wrapper - so those are either left-aligned with the content if they're less than the width of the content wrapper, or they consume 100% of the content width with no max-width.

.ws-docs-content-img

  • will only grow up to 700px
  • centers itself horizontally
  • centers its child horizontally (if the image inside is less than 700px)
  • Button docs use this with a bunch of varied image sizes - https://www.patternfly.org/components/button/design-guidelines

https://github.com/patternfly/patternfly-org/blob/b455d81018a53a3986a2dca9f12628d179fe8f7e/packages/documentation-site/patternfly-docs/content/design-guidelines/components/components.css#L1-L6

.ws-image

  • centers its child horizontally
  • same as above but will grow to 100% of the available width instead of a max of 700px

https://github.com/patternfly/patternfly-org/blob/b455d81018a53a3986a2dca9f12628d179fe8f7e/packages/documentation-framework/templates/mdx.css#L19-L21

.ws-images

  • centers itself horizontally
  • has a max-width of 600px
  • Same as the first one except 600px instead of 700px and it will not center its children, so if an image less than 600px wide is passed, it will be left aligned within the container.

https://github.com/patternfly/patternfly-org/blob/b455d81018a53a3986a2dca9f12628d179fe8f7e/packages/site/src/content/get-started/get-started.css#L5-L8

mcoker avatar Oct 13 '25 19:10 mcoker

cc @bekah-stephens @edonehoo @andrew-ronaldson do y'all have any feedback? I can provide screenshots/codepens with changes if needed.

I'll say that the easiest is probably just not have a special container for images. Only because then nobody has to remember to add a special wrapper around images to get the centered/max-width/etc effects.

Here are a couple that just have images and no special wrapper

  • https://www.patternfly.org/components/about-modal/design-guidelines (wide images)
  • https://www.patternfly.org/charts/about-charts (varied sizes)

mcoker avatar Oct 13 '25 20:10 mcoker

Definitely +1 to standardizing

The max width has been helpful in certain instances where a full-width image would be too intrusive/blurry (for ex, chatbot images that are taller than they are wide) or for png screenshots (like in this tokens doc).

But maybe we can just standardize the frame width before exporting from Figma, and just let some images have larger white "margins"? Or, specify a width for individual images as needed (like on the parent div or img tag)

edonehoo avatar Oct 14 '25 13:10 edonehoo

@edonehoo thanks! I'd love to have something as simple as it can be for folks to use so there's less risk someone doesn't export in a special way or add the right classes or whatever when adding an image to docs. I imagine there is something folks will have to do, but the less the better IMO 👍

For the CSS/class that can do the centering/width manipulation, we can also draw a frame around the image if this is what you were referring to. We may also consider a relative max-width instead of a Like "80%" or so instead of "700px", so it could apply at all viewport widths (including mobile). I'm not necessarily recommending either, just showing something we could do with CSS.

Before: Image

After: Image

mcoker avatar Oct 14 '25 16:10 mcoker