Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2universalStack: React / CSS layout
component-designreuselayoutseparation-of-concerns
Let reusable item components span full width and size them in the parent
Keep single-item components layout-neutral (full width) and apply grid/width sizing in the parent that maps over them, so the item stays reusable in different layouts.
PR: abcn-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | function ArticleTeaser() { |
| 2 | return <div className='small-6 large-4 cell'>...</div>; // width baked into item |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | function ArticleTeaser() { |
| 2 | return <div>...</div>; // full width, layout-neutral |
| 3 | } |
| 4 | // parent controls width |
| 5 | {articles.map(a => ( |
| 6 | <div className='small-6 large-4 cell'><ArticleTeaser article={a} /></div> |
| 7 | ))} |
Explanation (EN)
Objašnjenje (HR)