Namespace collision between grid areas components and custom component
See original GitHub issueWhat:
When using render prop of Composition component it generates areas components based on grid-template-areas
. This often leads to semantic namespaces collision with corresponding custom React components:
import { Composition } from 'atomic-layout'
import Header from './components/Header'
const Page = () => (
<Composition areas="header footer">
{({ Header }) => (
<>
<Header><Header /></Header> // oops, collision!
</>
)}
</Composition>
)
Why:
- It decreases the DX with the library
- Grid areas often reflect semantics of a layout, just as actual component’s names
- Polymorphic prop doesn’t help, as area component’s name already exists in scope in order to use polymorphic prop
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Introduction to collision - Unity - Manual
Static colliders. You can add colliders to a GameObject without a Rigidbody component to create floors, walls and other motionless elements of a...
Read more >Web Components - MDN Web Docs - Mozilla
A guide showing how to use the features of custom elements to create simple web components, as well as looking into lifecycle callbacks...
Read more >ASP.NET Core Razor components - Microsoft Learn
Paths indicate typical folder locations. For example, Pages/ProductDetail.razor indicates that the ProductDetail component has a file name of ...
Read more >Guide to the MUI grid system - LogRocket Blog
A grid system defines a set of measurements to place elements or components on the page based on successive columns and rows. The...
Read more >Custom Component Builder - ServiceNow Docs
The Next Experience Design System comes with a set of customizable components that you can drag into your custom UI. Develop your own...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Proposal:
Area
generic componentAtomic layout can expose a generic
Area
component that would act as a single domain for rendering and mapping components to grid areas.Spec
Area
component accepts all prop aliases as theBox
componentArea
component supportsas: JSX.Element
polymorphic prop.Area
component supportsname: string
prop that producesgrid-area ${props.name}
mapping to CSS Grid areasareas
props, wrapping conditional areas into<MediaQuery/>
wrapper (as render prop functionality does now)Usage
This also means that the value of
name
prop can be dynamic, switching the content of the area, without changing the area position. This can come in handy when combined with #132:How about <Area.Logo></Area.Logo> typescript autocomplete potential?