Skip to content

feat: add story layout prop#19

Merged
timhanlon merged 4 commits intomainfrom
feat/layout
Mar 4, 2025
Merged

feat: add story layout prop#19
timhanlon merged 4 commits intomainfrom
feat/layout

Conversation

@davestewart
Copy link
Collaborator

@davestewart davestewart commented Mar 4, 2025

Overview

This PR adds layout props to Story components:

<Story :layout="{ type: 'grid', cols: 3 }">...</Story>

It attempts to mirror our used functionality from Histoire, but also:

  • correctly-calculates widths and gaps for arbitrary column amounts in CSS
  • supports a new cols value (rather than entering percentages)
  • supports the old <width>px value (fixes pixel value and wraps)
  • supports the old <width>% value (calculates cols and wraps)
  • the type: grid value is not strictly required; can just enter { cols: 4 } and it is inferred

It also makes some decisions on styling:

  • variant header styling is no-wrap + truncated
  • default padding gap is now 1.5rem

Screenshots

CleanShot 2025-03-04 at 03 20 14

@davestewart davestewart requested a review from timhanlon March 4, 2025 03:24
@timhanlon timhanlon merged commit 6b00c6e into main Mar 4, 2025
2 checks passed
@timhanlon timhanlon deleted the feat/layout branch March 4, 2025 05:21
@timhanlon
Copy link
Owner

Amazing, thanks!

@davestewart
Copy link
Collaborator Author

One thing it could do with would be a default layout.

Perhaps we can do that with runtime config.

davestewart added a commit that referenced this pull request Mar 4, 2025
* main:
  feat: add story layout prop (#19)
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