Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render callback for EditInline to support conditional rendering #145

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DavidBachmann
Copy link
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
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