Skip to content

Conversation

@devongovett
Copy link
Member

Adds examples section to new RAC docs. Ports over a few examples from the old docs, and adds a few new ones.

A few other bug fixes are included:

  • Changed size() macro to return calc directly without wrapping in square brackets, enabling it to be interpolated into CSS strings.
  • Removed font-variation-settings from the Spectrum macro theme now that the Typekit issue has been fixed for a while. This was causing incorrect fonts to display in Tailwind and Vanilla CSS examples which were not overriding it.
  • Added support for standalone S2 Cards to render as links when they have an href. Such cards must not have interactive elements within them.
  • Fixed border-width of tertiary cards (random bug that was reported in Slack)
  • Fixed WaterfallLayout so that when you change the size of the cards they reflow properly. Also if you filter the collection they should also re-layout and not stick to their previous column.

let press = pressScale(domRef, UNSAFE_style);
if (ElementType === 'div' && !isSkeleton && props.href) {
// Standalone Card that has an href should be rendered as a Link.
// NOTE: In this case, the card must not contain interactive elements.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really have a way to enforce this...

let estimatedSize = true;
if (oldLayoutInfo) {
height = oldLayoutInfo.rect.height;
height = oldLayoutInfo.rect.height / oldLayoutInfo.rect.width * itemWidth;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the card size changes (e.g. user drags slider in photo library example), re-calculate the height proportionally.

// Figure out which column to place the item in, and compute its position.
// Preserve the previous column index so items don't jump around during resizing unless the number of columns changed.
let prevColumn = numColumns === this.numColumns && oldLayoutInfo && oldLayoutInfo.rect.y < this.virtualizer!.visibleRect.maxY ? oldLayoutInfo.column : undefined;
let prevColumn = numColumns === this.numColumns && oldLayoutInfo && oldLayoutInfo.index === index && oldLayoutInfo.rect.y < this.virtualizer!.visibleRect.maxY ? oldLayoutInfo.column : undefined;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't preserve the column if the index within the collection changed. When filtering the photo library, the cards were staying where they were previously, resulting in "holes" appearing. We want to re-flow in this case.

@rspbot
Copy link

rspbot commented Oct 24, 2025

@rspbot
Copy link

rspbot commented Oct 25, 2025

@rspbot
Copy link

rspbot commented Oct 25, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants