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

Remove tippy #264

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,12 @@
"react-router-dom": "5.x"
},
"dependencies": {
"@tippyjs/react": "4.2.6",
"classnames": "2.3.2",
"d3": "5.16.0",
"foundation-sites": "6.7.5",
"history": "4.10.1",
"lodash-es": "4.17.21",
"timing-functions": "2.0.1",
"tippy.js": "6.3.7",
"type-fest": "3.1.0",
"uuid": "9.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ exports[`DataTable should render autoload 1`] = `
</th>
<th
class="data-table__header-cell--sortable data-table__header-cell--ascend"
data-column-name="content1"
>
Column 1
</th>
<th
class=""
data-column-name="content2"
>
Column 2
</th>
<th
class="data-table__header-cell--sortable"
data-column-name="content3"
>
<h1>
Column 3
Expand Down Expand Up @@ -338,16 +341,19 @@ exports[`DataTable should render click-to-load 1`] = `
</th>
<th
class="data-table__header-cell--sortable data-table__header-cell--ascend"
data-column-name="content1"
>
Column 1
</th>
<th
class=""
data-column-name="content2"
>
Column 2
</th>
<th
class="data-table__header-cell--sortable"
data-column-name="content3"
>
<h1>
Column 3
Expand Down
23 changes: 3 additions & 20 deletions src/components/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import {
HTMLAttributes,
useRef,
useMemo,
forwardRef,
} from 'react';
import cn from 'classnames';
import { v1 } from 'uuid';
import Tippy from '@tippyjs/react';

import Loader from './loader';

Expand All @@ -19,8 +17,6 @@ import withDataLoader, { WrapperProps } from './data-loader';

import '../styles/components/data-table.scss';

import 'tippy.js/dist/tippy.css';

type BasicDatum = Record<string, unknown>;

type CommonColumn<Datum> = {
Expand Down Expand Up @@ -69,14 +65,6 @@ type HeadProps<Datum> = {
const LabelContent = ({ label }: { label: ReactNode }): JSX.Element =>
typeof label === 'function' ? label() : label;

const TippyLabelContent = forwardRef<HTMLElement, { label: ReactNode }>(
({ label }, ref) => (
<span ref={ref}>
<LabelContent label={label} />
</span>
)
);

const DataTableHead = <Datum extends BasicDatum>({
columns,
onHeaderClick,
Expand All @@ -90,7 +78,7 @@ const DataTableHead = <Datum extends BasicDatum>({
<div className="checkbox-cell">{checkbox}</div>
</th>
)}
{columns.map(({ sorted, name, label, tooltip, sortable, width }) => (
{columns.map(({ sorted, name, label, sortable, width }) => (
<th
key={name}
className={cn({
Expand All @@ -100,14 +88,9 @@ const DataTableHead = <Datum extends BasicDatum>({
})}
onClick={sortable ? () => onHeaderClick?.(name) : undefined}
style={width ? { width } : undefined}
data-column-name={name}
>
{tooltip && typeof tooltip !== 'undefined' ? (
<Tippy content={tooltip} interactive placement="bottom">
<TippyLabelContent label={label} />
</Tippy>
) : (
<LabelContent label={label} />
)}
<LabelContent label={label} />
</th>
))}
</tr>
Expand Down
7 changes: 0 additions & 7 deletions src/styles/components/data-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,4 @@
white-space: nowrap;
}
}

// Tippy link styling
.tippy-content a,
.tippy-content a.external-link {
color: white;
text-decoration: underline;
}
}
19 changes: 0 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2951,11 +2951,6 @@
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.9.2.tgz#adea7b6953cbb34651766b0548468e743c6a2353"
integrity sha512-VZMYa7+fXHdwIq1TDhSXoVmSPEGM/aa+6Aiq3nVVJ9bXr24zScr+NlKFKC3iPljA7ho/GAZr+d2jOf5GIRC30Q==

"@popperjs/core@^2.9.0":
version "2.11.2"
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.2.tgz#830beaec4b4091a9e9398ac50f865ddea52186b9"
integrity sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==

"@reach/router@^1.2.1", "@reach/router@^1.3.4":
version "1.3.4"
resolved "https://registry.yarnpkg.com/@reach/router/-/router-1.3.4.tgz#d2574b19370a70c80480ed91f3da840136d10f8c"
Expand Down Expand Up @@ -3960,13 +3955,6 @@
"@babel/runtime" "^7.12.5"
"@testing-library/dom" "^8.0.0"

"@tippyjs/[email protected]":
version "4.2.6"
resolved "https://registry.yarnpkg.com/@tippyjs/react/-/react-4.2.6.tgz#971677a599bf663f20bb1c60a62b9555b749cc71"
integrity sha512-91RicDR+H7oDSyPycI13q3b7o4O60wa2oRbjlz2fyRLmHImc4vyDwuUP8NtZaN0VARJY5hybvDYrFzhY9+Lbyw==
dependencies:
tippy.js "^6.3.1"

"@tootallnate/once@2":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf"
Expand Down Expand Up @@ -15885,13 +15873,6 @@ tiny-warning@^1.0.0, tiny-warning@^1.0.3:
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==

[email protected], tippy.js@^6.3.1:
version "6.3.7"
resolved "https://registry.yarnpkg.com/tippy.js/-/tippy.js-6.3.7.tgz#8ccfb651d642010ed9a32ff29b0e9e19c5b8c61c"
integrity sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==
dependencies:
"@popperjs/core" "^2.9.0"

[email protected]:
version "1.0.5"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
Expand Down