Skip to content
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
31 changes: 0 additions & 31 deletions src/theme/src/hooks/useTooltipStyle.js

This file was deleted.

4 changes: 3 additions & 1 deletion src/themes/classic/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import Button from './button'
import Code from './code'
import Pane from './pane'
import Select from './select'
import Tooltip from './tooltip'

export default {
Alert,
Button,
Code,
Pane,
Select
Select,
Tooltip
}
24 changes: 24 additions & 0 deletions src/themes/classic/components/tooltip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const baseStyle = {
paddingY: 8,
paddingX: 16,
borderRadius: 'radii.1',
elevation: 'shadows.3'
}

const appearances = {
card: {
backgroundColor: 'white'
},
default: {
color: 'white',
backgroundColor: 'palette.neutral.base'
}
}

const sizes = {}

export default {
baseStyle,
appearances,
sizes
}
4 changes: 3 additions & 1 deletion src/themes/default/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import Button from './button'
import Code from './code'
import Pane from './pane'
import Select from './select'
import Tooltip from './tooltip'

export default {
Alert,
Button,
Code,
Pane,
Select
Select,
Tooltip
}
25 changes: 25 additions & 0 deletions src/themes/default/components/tooltip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const baseStyle = {
paddingY: 8,
paddingX: 16,
maxWidth: 240,
borderRadius: 'radii.2',
elevation: 'shadows.3'
}

const appearances = {
card: {
backgroundColor: 'white'
},
default: {
color: 'white',
backgroundColor: 'colors.gray800'
}
}

const sizes = {}

export default {
baseStyle,
appearances,
sizes
}
23 changes: 13 additions & 10 deletions src/tooltip/src/TooltipStateless.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@ import React, { memo, forwardRef } from 'react'
import PropTypes from 'prop-types'
import { Pane } from '../../layers'
import { Paragraph } from '../../typography'
import useTooltipStyle from '../../theme/src/hooks/useTooltipStyle'
import useStyleConfig from '../../hooks/use-style-config'

const pseudoSelectors = {}
const internalStyles = {}

const TooltipStateless = memo(
forwardRef(function TooltipStateless(props, ref) {
const { children, appearance, ...restProps } = props
console.log(appearance)
const { color, ...themedProps } = useTooltipStyle(appearance)
const { ...boxProps } = useStyleConfig(
'Tooltip',
{ appearance },
pseudoSelectors,
internalStyles
)

const { color, ...themedProps } = boxProps

let child
if (typeof children === 'string') {
Expand All @@ -22,13 +31,7 @@ const TooltipStateless = memo(
}

return (
<Pane
ref={ref}
borderRadius={8}
maxWidth={240}
{...themedProps}
{...restProps}
>
<Pane ref={ref} {...themedProps} {...restProps}>
{child}
</Pane>
)
Expand Down