Skip to content

Commit

Permalink
[website] add tooltip cell example
Browse files Browse the repository at this point in the history
  • Loading branch information
nihgwu committed Jul 15, 2019
1 parent 808c271 commit 1a20d85
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 7 deletions.
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"react-live-runner": "^0.7.3",
"react-overlays": "^1.2.0",
"react-sortable-hoc": "^1.9.1",
"react-texty": "^0.1.0",
"rehype-react": "^3.1.0",
"seamless-immutable": "^7.1.4",
"slugify": "^1.3.4",
Expand Down
12 changes: 8 additions & 4 deletions website/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ module.exports = {
title: 'JSX Column',
path: '/examples/jsx-column',
},
{
title: 'Tooltip Cell',
path: '/examples/tooltip-cell',
},
{
title: 'Auto Resize',
path: '/examples/auto-resize',
Expand All @@ -76,10 +80,6 @@ module.exports = {
title: '10000 Rows',
path: '/examples/10000-rows',
},
{
title: 'Draggable Rows',
path: '/examples/draggable-rows',
},
{
title: 'Disabled',
path: '/examples/disabled',
Expand All @@ -92,6 +92,10 @@ module.exports = {
title: 'Hide Header',
path: '/examples/hide-header',
},
{
title: 'Draggable Rows',
path: '/examples/draggable-rows',
},
{
title: 'Multi Header',
path: '/examples/multi-header',
Expand Down
4 changes: 3 additions & 1 deletion website/src/components/Methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const Method = styled.div`
margin-bottom: 1.6rem;
`

const Name = styled.h4``
const Name = styled.div`
font-weight: 600;
`

const Tag = styled.span`
font-size: 0.8em;
Expand Down
4 changes: 3 additions & 1 deletion website/src/components/Props.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const Prop = styled.div`
margin-bottom: 1.6rem;
`

const Name = styled.h4``
const Name = styled.div`
font-weight: 600;
`

const Tag = styled.span`
font-size: 0.8em;
Expand Down
23 changes: 23 additions & 0 deletions website/src/examples/tooltip-cell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// import Text from 'react-texty'
const Text = ReactTexty

const TableCell = ({ className, cellData }) => (
<Text className={className}>{cellData}</Text>
)

const TableHeaderCell = ({ className, column }) => (
<Text className={className}>{column.title}</Text>
)

const columns = generateColumns(10)
const data = generateData(columns, 200)
columns[3].title = 'No tooltip'
columns[3].minWidth = 150

export default () => (
<Table
columns={columns}
data={data}
components={{ TableCell, TableHeaderCell }}
/>
)
6 changes: 6 additions & 0 deletions website/src/styles/index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import '~minireset.css';
@import '~react-texty/styles.css';

html {
font-size: 62.5%;
Expand Down Expand Up @@ -84,3 +85,8 @@ pre {
background-color: #f3f3f3;
border-radius: 0.3em;
}

[data-texty-tooltip] {
font-size: 1.2rem;
padding: 0.2rem 0.8rem;
}
2 changes: 2 additions & 0 deletions website/src/utils/baseScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ReactDOM from 'react-dom'
import styled, { css, keyframes, createGlobalStyle } from 'styled-components'
import * as ReactSortableHoc from 'react-sortable-hoc'
import * as ReactOverlays from 'react-overlays'
import ReactTexty from 'react-texty'

import BaseTable, {
Column,
Expand Down Expand Up @@ -57,6 +58,7 @@ export default {

ReactSortableHoc,
ReactOverlays,
ReactTexty,

BaseTable,
Column,
Expand Down
9 changes: 8 additions & 1 deletion website/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9111,7 +9111,7 @@ react-overlays@^1.2.0:
uncontrollable "^6.0.0"
warning "^4.0.2"

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

react-texty@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/react-texty/-/react-texty-0.1.0.tgz#405a76f77705c84a1b154cb68e9e51bd5babe055"
integrity sha512-THyjCs5xnfATh50tpgIbqkKs1J5mYISAGGRpnII57so6XlnFdajonieAo1VcXNqEIFuvXF2LX++yGxfW+zqWew==
dependencies:
react-popper "^1.3.3"

react@^16.8.4, react@^16.8.5:
version "16.8.6"
resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe"
Expand Down

0 comments on commit 1a20d85

Please sign in to comment.