⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

add custom heading component#48

Open
dehbmarques wants to merge 1 commit intoGriddleGriddle:masterfrom
dehbmarques:master
Open

add custom heading component#48
dehbmarques wants to merge 1 commit intoGriddleGriddle:masterfrom
dehbmarques:master

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