Created
August 18, 2019 15:46
-
-
Save sharvit/a8cfd14dd69ba33285af9428902fa42f to your computer and use it in GitHub Desktop.
Slot and fill suggestion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const LayoutToolbarButtonsSlot = () => (<> | |
<Slot id="layout-toolbar-buttons" multi /> | |
<Fill slot="layout-toolbar-buttons" weight={100}> | |
<ExportButton /> | |
</Fill> | |
<Fill slot="layout-toolbar-buttons" weight={200}> | |
<DocumentationButton documentationURL={documentationURL} /> | |
</Fill> | |
</>); | |
const FillLayoutToolbarButtonsWithDefaults = () => ( | |
<> | |
<Fill slot="layout-toolbar-buttons" weight={100}> | |
<ExportButton /> | |
</Fill> | |
<Fill slot="layout-toolbar-buttons" weight={200}> | |
<DocumentationButton documentationURL={documentationURL} /> | |
</Fill> | |
</> | |
); | |
const FillSlotWithDefaults = ({ slotId, fills }) => ( | |
<> | |
{fills.map(fill => <Fill slot="layout-toolbar-buttons" weight={100}>{fill}</Fill>)} | |
</> | |
); | |
<div><LayoutToolbarButtonsSlot /></div> | |
<Slot id="layout-toolbar-buttons" multi /> | |
<FillSlotWithDefaults slotId="layout-toolbar-buttons" fills={ | |
<> | |
<ExportButton /> | |
<DocumentationButton documentationURL={documentationURL} /> | |
</> | |
} /> | |
<Slot id="layout-toolbar-buttons" multi> | |
<ExportButton /> | |
<DocumentationButton documentationURL={documentationURL} /> | |
</Slot> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment