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

add custom heading component #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dehbmarques
Copy link

Related to #13.

I added one customHeadingComponent prop in the ColumnDefinition.
When a component is defined in this customHeadingComponent prop, it will be rendered instead of the default title + sortIcon.
eg:

class Header extends Component {

  render() {
    return (
      <span>Custom {this.props.title} {this.props.sortIcon}</span>
    );
  }
}

export default class App extends Component {

  render() {

    return (
      <Griddle data={fakeData}>
        <RowDefinition>
          <ColumnDefinition id="name" customHeadingComponent={Header} />
          <ColumnDefinition id="city" />
        </RowDefinition>
      </Griddle>
    );
  }
}

I kept the customHeadingComponent propType as an object, like the customComponent.
But shouldn't it be an element?

Great component btw. I've been using a lot.

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