Skip to content

Commit 1a20d85

Browse files
committed
[website] add tooltip cell example
1 parent 808c271 commit 1a20d85

File tree

8 files changed

+54
-7
lines changed

8 files changed

+54
-7
lines changed

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"react-live-runner": "^0.7.3",
3232
"react-overlays": "^1.2.0",
3333
"react-sortable-hoc": "^1.9.1",
34+
"react-texty": "^0.1.0",
3435
"rehype-react": "^3.1.0",
3536
"seamless-immutable": "^7.1.4",
3637
"slugify": "^1.3.4",

website/siteConfig.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ module.exports = {
5252
title: 'JSX Column',
5353
path: '/examples/jsx-column',
5454
},
55+
{
56+
title: 'Tooltip Cell',
57+
path: '/examples/tooltip-cell',
58+
},
5559
{
5660
title: 'Auto Resize',
5761
path: '/examples/auto-resize',
@@ -76,10 +80,6 @@ module.exports = {
7680
title: '10000 Rows',
7781
path: '/examples/10000-rows',
7882
},
79-
{
80-
title: 'Draggable Rows',
81-
path: '/examples/draggable-rows',
82-
},
8383
{
8484
title: 'Disabled',
8585
path: '/examples/disabled',
@@ -92,6 +92,10 @@ module.exports = {
9292
title: 'Hide Header',
9393
path: '/examples/hide-header',
9494
},
95+
{
96+
title: 'Draggable Rows',
97+
path: '/examples/draggable-rows',
98+
},
9599
{
96100
title: 'Multi Header',
97101
path: '/examples/multi-header',

website/src/components/Methods.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ const Method = styled.div`
88
margin-bottom: 1.6rem;
99
`
1010

11-
const Name = styled.h4``
11+
const Name = styled.div`
12+
font-weight: 600;
13+
`
1214

1315
const Tag = styled.span`
1416
font-size: 0.8em;

website/src/components/Props.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ const Prop = styled.div`
88
margin-bottom: 1.6rem;
99
`
1010

11-
const Name = styled.h4``
11+
const Name = styled.div`
12+
font-weight: 600;
13+
`
1214

1315
const Tag = styled.span`
1416
font-size: 0.8em;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// import Text from 'react-texty'
2+
const Text = ReactTexty
3+
4+
const TableCell = ({ className, cellData }) => (
5+
<Text className={className}>{cellData}</Text>
6+
)
7+
8+
const TableHeaderCell = ({ className, column }) => (
9+
<Text className={className}>{column.title}</Text>
10+
)
11+
12+
const columns = generateColumns(10)
13+
const data = generateData(columns, 200)
14+
columns[3].title = 'No tooltip'
15+
columns[3].minWidth = 150
16+
17+
export default () => (
18+
<Table
19+
columns={columns}
20+
data={data}
21+
components={{ TableCell, TableHeaderCell }}
22+
/>
23+
)

website/src/styles/index.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@import '~minireset.css';
2+
@import '~react-texty/styles.css';
23

34
html {
45
font-size: 62.5%;
@@ -84,3 +85,8 @@ pre {
8485
background-color: #f3f3f3;
8586
border-radius: 0.3em;
8687
}
88+
89+
[data-texty-tooltip] {
90+
font-size: 1.2rem;
91+
padding: 0.2rem 0.8rem;
92+
}

website/src/utils/baseScope.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import ReactDOM from 'react-dom'
33
import styled, { css, keyframes, createGlobalStyle } from 'styled-components'
44
import * as ReactSortableHoc from 'react-sortable-hoc'
55
import * as ReactOverlays from 'react-overlays'
6+
import ReactTexty from 'react-texty'
67

78
import BaseTable, {
89
Column,
@@ -57,6 +58,7 @@ export default {
5758

5859
ReactSortableHoc,
5960
ReactOverlays,
61+
ReactTexty,
6062

6163
BaseTable,
6264
Column,

website/yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9111,7 +9111,7 @@ react-overlays@^1.2.0:
91119111
uncontrollable "^6.0.0"
91129112
warning "^4.0.2"
91139113

9114-
react-popper@^1.3.2:
9114+
react-popper@^1.3.2, react-popper@^1.3.3:
91159115
version "1.3.3"
91169116
resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-1.3.3.tgz#2c6cef7515a991256b4f0536cd4bdcb58a7b6af6"
91179117
integrity sha512-ynMZBPkXONPc5K4P5yFWgZx5JGAUIP3pGGLNs58cfAPgK67olx7fmLp+AdpZ0+GoQ+ieFDa/z4cdV6u7sioH6w==
@@ -9162,6 +9162,13 @@ react-sortable-hoc@^1.9.1:
91629162
invariant "^2.2.4"
91639163
prop-types "^15.5.7"
91649164

9165+
react-texty@^0.1.0:
9166+
version "0.1.0"
9167+
resolved "https://registry.yarnpkg.com/react-texty/-/react-texty-0.1.0.tgz#405a76f77705c84a1b154cb68e9e51bd5babe055"
9168+
integrity sha512-THyjCs5xnfATh50tpgIbqkKs1J5mYISAGGRpnII57so6XlnFdajonieAo1VcXNqEIFuvXF2LX++yGxfW+zqWew==
9169+
dependencies:
9170+
react-popper "^1.3.3"
9171+
91659172
react@^16.8.4, react@^16.8.5:
91669173
version "16.8.6"
91679174
resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe"

0 commit comments

Comments
 (0)