Skip to content

Render callback for EditInline to support conditional rendering#145

Open
DavidBachmann wants to merge 2 commits intomasterfrom
render-callback
Open

Render callback for EditInline to support conditional rendering#145
DavidBachmann wants to merge 2 commits intomasterfrom
render-callback

Conversation

@DavidBachmann
Copy link
Copy Markdown
Member

@DavidBachmann DavidBachmann commented Sep 14, 2017

Proposed API:

  <EditInline
    field="fields.content.tagline"
    defaultValue="Some default value"
    children={({ value }) => <AnimatedText>{value}</AnimatedText>}
  />

Solves the need for users to use createEditable directly, like we're doing on Aranja.com at the moment:

const EditableAnimatedText = ({
  isEditing,
  children,
  field,
  value,
  placeholder,
  ...props
}) =>
  isEditing ? (
    <EditInline field={field} placeholder={placeholder} />
  ) : (
    <AnimatedText {...props}>{value}</AnimatedText>
  )

export default createEditable()(EditableAnimatedText)

@DavidBachmann DavidBachmann changed the title {WIP} Render callback for EditInline to support conditional rendering Render callback for EditInline to support conditional rendering Sep 15, 2017
@DavidBachmann
Copy link
Copy Markdown
Member Author

You want to take over, @eirikurn?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant