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

style component theme #26

Open
fobbyal opened this issue Jan 20, 2018 · 3 comments
Open

style component theme #26

fobbyal opened this issue Jan 20, 2018 · 3 comments
Assignees

Comments

@fobbyal
Copy link
Owner

fobbyal commented Jan 20, 2018

Project Background

This is a project that utilized react-virtualized, downshft,react-popper to create a excel-like react component. ( without the function stuff)

Environment

Specification

Header styles are currently hardcoded. We want to make it so that we can customize the header render first.
image

We want to make it customizable via Context Api. This project currently does support hooks feel free to use useContext. Utilize existing src/context.js to handle theme based states.

Grid Renders

We currently support 2 types of grids that are rendered by src/flexRender.js and virtualized/virtualizedRenderer.js. Theses are demoed by the following storybook links respectively. We need the style theme to work for both type of renders.
image

@fraindz
Copy link
Collaborator

fraindz commented Dec 13, 2019

@fobbyal BasicColHeader appears to be the parent component that is extended by different components. ColHeader for flexRenderer & ColHeaderBase for virtualized.
There are also other components like ScrollingHeaderRow which appear to be using hardcoded styles though these appear to be for specific cases.

In case of virtualizedRender, I also see Provider component that wraps the entire grid. The structure appears in place to provide default header config through this component.
I could not find similar provider component for flexRenderer though. Might need to add a Provider for flexRenderer.

Let me know your thoughts on above analysis.

@fobbyal
Copy link
Owner Author

fobbyal commented Dec 14, 2019

@fraindz You are correct about the analysis. There are places in both flexRender and virtualizedRender to supply custom render functions for the Headers. However that requires the implementation of the whole render, we often just want some styling changed. Our goal here is to have a Provider that is available to code that are rendering the grid so the styling can be controlled from outside of this library. please see the storybook example at

<GridToolContext.Provider value={{ debug: true }}>
<Grid
data={data}
headers={debugHeaders}
isEditable
editMode="cell"
{...createControlledEditProps({ data, setData, processEdit })}
render={flexGridRenderer({
headerRowHeight: 60,
width: 1100,
height: 400,
autoFixColByKey: true,
})}
/>
</GridToolContext.Provider>

By specifying the debug:true. The gird-tools code-based will log more information when rendering. What we essentially want is to add more props to GridToolContext so we can control the styles of the colHeaders without specifying complex render functions.

@fraindz
Copy link
Collaborator

fraindz commented Dec 14, 2019

@fobbyal That helps. I will make changes and create PR.

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

No branches or pull requests

2 participants