Skip to content

Commit

Permalink
css moved to styles.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
nicocarlier committed Jan 11, 2024
1 parent 46e6778 commit 0d4ca6a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import React, {
useCallback,
useRef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import React, {
useRef,
useMemo,
Expand Down Expand Up @@ -110,6 +111,7 @@ const fixedTableLayout: CSSProperties = { tableLayout: 'fixed' };
/**
* An HOC for generating sticky header and fixed-height scrollable area
*/

function StickyWrap({
sticky = {},
width: maxWidth,
Expand Down Expand Up @@ -215,7 +217,9 @@ function StickyWrap({
let sizerTable: ReactElement | undefined;
let headerTable: ReactElement | undefined;
let footerTable: ReactElement | undefined;
let bodyTable: ReactElement | undefined;
// let bodyTable: ReactElement | undefined;
let fullTable: ReactElement | undefined;

if (needSizer) {
const theadWithRef = React.cloneElement(thead, { ref: theadRef });
const tfootWithRef = tfoot && React.cloneElement(tfoot, { ref: tfootRef });
Expand Down Expand Up @@ -253,6 +257,7 @@ function StickyWrap({
style={{
overflow: 'hidden',
}}
aria-hidden="true"
>
{React.cloneElement(
table,
Expand Down Expand Up @@ -290,20 +295,18 @@ function StickyWrap({
scrollFooterRef.current.scrollLeft = e.currentTarget.scrollLeft;
}
};
bodyTable = (

fullTable = (
<div
key="body"
key="full-table"
ref={scrollBodyRef}
style={{
height: bodyHeight,
overflow: 'auto',
}}
onScroll={sticky.hasHorizontalScroll ? onScroll : undefined}
>
{React.cloneElement(
table,
mergeStyleProp(table, fixedTableLayout),
colgroup,
thead,
tbody,
)}
</div>
Expand All @@ -315,11 +318,12 @@ function StickyWrap({
style={{
width: maxWidth,
height: sticky.realHeight || maxHeight,
overflow: 'hidden',
overflow: 'auto',
padding: '0',
}}
>
{headerTable}
{bodyTable}
{/* {headerTable} */}
{fullTable}
{footerTable}
{sizerTable}
</div>
Expand Down
6 changes: 4 additions & 2 deletions superset-frontend/plugins/plugin-chart-table/src/Styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ export default styled.div`
td {
min-width: 4.3em;
}
thead > tr > th {
position: sticky;
top: -1px;
padding-right: 0;
position: relative;
z-index: 100;
border-bottom: 2px solid #e0e0e0;
background: ${theme.colors.grayscale.light5};
text-align: left;
}
Expand Down

0 comments on commit 0d4ca6a

Please sign in to comment.