svg-to-geojson icon indicating copy to clipboard operation
svg-to-geojson copied to clipboard

frint-react: Empty Component when Region is empty

Open fahad19 opened this issue 8 years ago • 3 comments

Current situation

Right now, when a Region has no Apps to render, it just remains empty.

It would be useful if we can pass some default Component to render in those cases.

Proposed API

import EmptyRegionContent from '../components/EmptyRegionContent';

<Region name="sidebar" empty={EmptyRegionContent} />

If the sidebar region is empty, it would render EmptyRegionContent component by default.

fahad19 avatar Jun 02 '17 10:06 fahad19

Nice idea!

As for naming, using something like default sounds more intuitive in my opinion. Mainly because the keyword is common in different languages (SQL, js, C#, etc...) for expressing a similar concept.

Should it also enable specifying a collection of default components?

discosultan avatar Sep 01 '17 08:09 discosultan

default is tricky, just like class, module and exports as variable names in JavaScript.

fahad19 avatar Sep 01 '17 09:09 fahad19

Yep, awesome idea. I like empty because it is the same as we do for lists.

asci avatar Nov 23 '17 13:11 asci