Skip to content

Commit

Permalink
Implemented the customization of styles of the Tooltip component
Browse files Browse the repository at this point in the history
  • Loading branch information
dkvovik committed Apr 2, 2024
1 parent 90e69c2 commit 24cf76a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
14 changes: 7 additions & 7 deletions packages/drawing-toolbar/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/drawing-toolbar/src/components/line-settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const lineSizes = {
EIGHT: 8,
}


export const LineSettings = ({
currentSize, handleClick, dashed = false,
}) => {
Expand Down
5 changes: 3 additions & 2 deletions packages/tooltip/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/tooltip/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/tooltip",
"version": "1.0.0",
"version": "1.0.1-dev-1-ULMS-2928",
"description": "",
"keywords": [
"lerna"
Expand Down Expand Up @@ -29,6 +29,7 @@
},
"peerDependencies": {
"@foxford/ui": "^2.17.0",
"lodash": "~4.17.21",
"react": "^16.14 || 17 || 18",
"react-dom": "^16.14 || 17 || 18",
"styled-components": "^5.0.0"
Expand Down
8 changes: 7 additions & 1 deletion packages/tooltip/src/tooltip.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable react/jsx-props-no-spreading */
import merge from 'lodash/merge'
import React, { memo, useMemo } from 'react'
import styled from 'styled-components'
import { Tooltip as TooltipComponent } from '@foxford/ui'
Expand All @@ -25,6 +26,8 @@ const styles = {
fontSize: '14px',
lineHeight: '130%',
color: '#333',
textAlign: 'center',
whiteSpace: 'pre-line',
},
arrow: {
spread: 16,
Expand Down Expand Up @@ -69,7 +72,10 @@ function _Tooltip ({
dark,
...tooltipProps
}) {
const computedStyles = useMemo(() => dark ? darkStyles : styles, [dark, customStyles])
const computedStyles = useMemo(
() => merge({}, dark ? darkStyles : styles, customStyles),
[dark, customStyles]
)

return disabled || hideTooltip
? (
Expand Down

0 comments on commit 24cf76a

Please sign in to comment.