Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Expose a wrapper for createComponent #498

Closed
bmdalex opened this issue Nov 20, 2018 · 0 comments · Fixed by #503
Closed

Expose a wrapper for createComponent #498

bmdalex opened this issue Nov 20, 2018 · 0 comments · Fixed by #503
Labels
vsts Paired with ticket in vsts

Comments

@bmdalex
Copy link
Collaborator

bmdalex commented Nov 20, 2018

Expose a wrapper for createComponent

Problem description

We need to enable users of the library to leverage Stardust capabilities, styling especially, in their own components or 3rd party components.

Proposed solution

  • create a thing wrapper function with the same name on top of createComponent;
  • export it in index file;
  • create relevant doc site example / prototype; thoughts?
  • the signature of the function should be:
import createComponentInternal from './createComponent'

export interface CreateComponentWrapperConfig<P> {
  displayName: string
  render: (props: P & { styles: ComponentSlotStylesPrepared }) => React.ReactNode
}

const createComponent = <P extends {} = {}>({
  displayName,
  render,
}: CreateComponentWrapperConfig<P>): React.SFC<P> => createComponentInternal({ displayName, render })

export default createComponent
@pkumarie2011 pkumarie2011 added the vsts Paired with ticket in vsts label Nov 20, 2018
@bmdalex bmdalex changed the title Rename Slot to Component and expose it expose a wrapper for createComponent Nov 20, 2018
@bmdalex bmdalex changed the title expose a wrapper for createComponent Expose a wrapper for createComponent Nov 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
vsts Paired with ticket in vsts
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants