-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
CSS cleanups, fixes, and reimplementations #1780
Conversation
isScrolling={isScrolling} | ||
isRowSelected={isRowSelected} | ||
onRowSelectionChange={onRowSelectionChange} | ||
/> | ||
{cellControls} | ||
</div> | ||
{tooltip && <span className="cell-tooltip-text">{tooltip}</span>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts about removing this here? Since the style is touched, if we want to remove, I bet it's better in this PR. Or we keep it for revisiting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do it in a separate PR.
@@ -22,6 +22,13 @@ | |||
width: 10px; | |||
} | |||
|
|||
@supports (position: sticky) or (position: -webkit-sticky) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? Currently we render all the header cells and adjust the scrolleft on scroll
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also iterate through all the columns to set/unset the scroll position of each header row cells.
I figure we should optimize this for browsers that support sticky position, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few cleanup comments. Cell actions example does not work, I think we need to replace the icons. May be we can import material icon for examples?
@@ -39,10 +39,6 @@ export default class EditorContainer<R> extends React.Component<Props<R>, State> | |||
const inputNode = this.getInputNode(); | |||
if (inputNode instanceof HTMLElement) { | |||
inputNode.focus(); | |||
if (!this.getEditor().disableContainerStyles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
const className = classNames('react-grid-HeaderCell', { | ||
const className = classNames('react-grid-Cell', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename it to rdg-cell
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, there's still a lot of opportunities to clean up the existing stylesheets, and rename classes, but I've mostly focused on replacing bootstrap in this PR.
|
||
const className = classNames('react-grid-HeaderCell', { | ||
const className = classNames('react-grid-Cell', { | ||
'rdg-header-cell-resizable': column.resizable, | ||
'react-grid-HeaderCell--frozen': isFrozen(column) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with react-grid-HeaderCell
}} | ||
className="react-grid-HeaderRow" | ||
className="rdg-header-row" | ||
style={{ height: this.props.height }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the height (500) was needed to show the Dropdown filters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, imo we should just reuse the editor container for such custom filters, otherwise it makes it hard to work with overflow: hidden
.
background-color: #66afe930; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.react-grid-Cell--frozen { | ||
/* Should have a higher value than 1 to show in front of cell masks */ | ||
z-index: 2; | ||
} | ||
.rdg-last--frozen { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can probably rename it to rdg-cell-last
overflow: hidden; | ||
height: inherit; | ||
} | ||
|
||
.react-grid-Cell.readonly { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need all the styles?
react-grid-Cell.readonly
react-grid-cell .form-control-feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, I haven't fully cleaned up this file.
} | ||
|
||
.react-grid-checkbox:checked + .react-grid-checkbox-label:before { | ||
.rdg-checkbox-label { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
.react-grid-HeaderCell--frozen:last-of-type { | ||
box-shadow: 2px 0 5px -2px rgba(136, 136, 136, .3); | ||
@supports (position: sticky) or (position: -webkit-sticky) { | ||
.react-grid-HeaderCell--frozen { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can raname these classes as well
{content} | ||
<span className="rdg-header-sort">{SORT_TEXT[sortDirection]}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we changed to MUI in this PR, should we change this as well to be an icon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave it like this for now.
@@ -69,9 +69,9 @@ class CustomDragLayer extends Component { | |||
if (c.formatter) { | |||
const Formatter = c.formatter; | |||
const dependentValues = typeof c.getRowMetaData === 'function' ? c.getRowMetaData(item, c) : {}; | |||
cells.push(<td key={`dragged-cell-${rowIdx}-${c.key}`} className="react-grid-Cell" style={{ padding: '5px' }}><Formatter dependentValues={dependentValues} value={item[c.key]} /></td>); | |||
cells.push(<td key={`dragged-cell-${rowIdx}-${c.key}`} className="rdg-cell" style={{ padding: '5px' }}><Formatter dependentValues={dependentValues} value={item[c.key]} /></td>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ padding: 5 }
? Any insights why this is not moved to css?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR doesn't aim to fix every styling issues in the repo, it's just trying to address issues that arose after removing the bootstrap styles. There are too many things to fix or cleanup otherwise.
-webkit-appearance: none; | ||
appearance: none; | ||
|
||
box-sizing: border-box; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to specify this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's too big otherwise.
@@ -124,17 +122,12 @@ export default forwardRef(function Header<R>(props: HeaderProps<R>, ref: React.R | |||
props.cellMetaData.onCellClick({ rowIdx: -1, idx: -1 }); | |||
} | |||
|
|||
const className = classNames('react-grid-Header', { | |||
'react-grid-Header--resizing': resizing !== null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no more this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look like we need it no.
color: #555555; | ||
} | ||
|
||
.rdg-sortable-header-cell { | ||
cursor: pointer; | ||
} | ||
|
||
.rdg-header-sort { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe using flex
and put 2 div
s inside rather than just float: right
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just works though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern is that when the columns width is 100px
while the header text width is like 200px
, will the sort icon being pushed to next line or keep in the view. I believe using float: right
will push it to next line. I am trying to run this PR in my local but having some packages installing issue.
Some things to note:
position: absolute; top: 50%; transform: translateY(-50%)
which may hurt text rendering or layout times.