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

[DCJ-741] refactor dataset table into two dataset and studies table #2691

Merged
merged 7 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
409 changes: 0 additions & 409 deletions src/components/CollapsibleTable.jsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/SimpleTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const DataRows = ({rowData, baseStyle, columnHeaders, rowWrapper = ({renderedRow
let output;
//columnHeaders determine width of the columns,
//therefore extract width from columnHeader and apply to cell style
const columnWidthStyle = columnHeaders[cellIndex].cellStyle;
const columnWidthStyle = { width: columnHeaders[cellIndex].cellStyle.width };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know where to check where this was used - but I was noticing we said we were extracting just the width, but actually pulling everything. I figured this would be cleaner.

const appliedStyle = Object.assign({}, style, columnWidthStyle);
//assume component is in hyperscript format
//wrap component in dive with columnWidth applied
Expand Down
36 changes: 36 additions & 0 deletions src/components/Tooltips.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import ReactTooltip from 'react-tooltip';
import * as React from 'react';
import {useEffect, useRef, useState} from 'react';

// Copied from ReactTooltip Types
type Place = 'top' | 'right' | 'bottom' | 'left';

interface TooltipProps {
tooltipText: string;
children: React.ReactNode | React.ReactNode[];
id: string;
place: Place
}
export const OverflowTooltip = (props: TooltipProps) => {
const ref = useRef<HTMLDivElement>(null);
const [isOverflown, setIsOverflown] = useState(false);
useEffect(() => {
const element = ref.current!;
setIsOverflown(element.offsetWidth < element.scrollWidth);
}, []);

return <>
<div
data-tip='Full details'
data-for={props.id}
ref={ref}
style={{overflow: 'hidden', textOverflow: 'ellipsis'}}
>{props.children}</div>
<ReactTooltip
place={'top'}
effect={'solid'}
disable={!isOverflown}
scrollHide={true}
id={props.id}><div style={{maxWidth: '30vw', textWrap: 'wrap'}}>{props.tooltipText}</div></ReactTooltip>
</>;
};
Loading
Loading