Skip to content

Commit

Permalink
新增className,style属性
Browse files Browse the repository at this point in the history
  • Loading branch information
bplok20010 committed Aug 5, 2020
1 parent 1b23f98 commit 6a3a378
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 17 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export default function App() {

```ts
export interface TooltipProps extends Omit<TriggerProps, "popup" | "defaultPopupVisible" | "popupVisible" | "destroyPopupOnHide" | "action" | "popupTransition" | "adjustPosition"> {
/** 提示框样式 */
className?: string;
/** 提示框样式属性 */
style?: React.CSSProperties;
/** 提示文字 */
title?: React.ReactNode | (() => React.ReactNode);
/** 提示框位置,可选 top left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottom */
Expand Down
6 changes: 3 additions & 3 deletions docs/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"index.css": "static/css/index.fa4784b4.chunk.css",
"index.js": "static/js/index.fa4784b4.chunk.js",
"index.css": "static/css/index.79eefb4a.chunk.css",
"index.js": "static/js/index.79eefb4a.chunk.js",
"runtime-index.js": "static/js/runtime-index.92eae014.js",
"static/js/2.b694e620.chunk.js": "static/js/2.b694e620.chunk.js",
"static/js/2.91961bd0.chunk.js": "static/js/2.91961bd0.chunk.js",
"index.html": "index.html"
}
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head><meta charset="utf-8"/><title>Tooltip</title><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"/><style>.demo{width:80%;margin:100px auto;background:#fff;font-size:12px;overflow:auto}</style><link href="static/css/index.fa4784b4.chunk.css" rel="stylesheet"></head><body style="background:#f5f5f5"><div class="demo" id="demo"></div><script src="static/js/runtime-index.92eae014.js"></script><script src="static/js/2.b694e620.chunk.js"></script><script src="static/js/index.fa4784b4.chunk.js"></script></body></html>
<!doctype html><html><head><meta charset="utf-8"/><title>Tooltip</title><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"/><style>.demo{width:80%;margin:100px auto;background:#fff;font-size:12px;overflow:auto}</style><link href="static/css/index.79eefb4a.chunk.css" rel="stylesheet"></head><body style="background:#f5f5f5"><div class="demo" id="demo"></div><script src="static/js/runtime-index.92eae014.js"></script><script src="static/js/2.91961bd0.chunk.js"></script><script src="static/js/index.79eefb4a.chunk.js"></script></body></html>
File renamed without changes.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/static/js/index.79eefb4a.chunk.js

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

1 change: 0 additions & 1 deletion docs/static/js/index.fa4784b4.chunk.js

This file was deleted.

2 changes: 1 addition & 1 deletion examples/demos/demo1.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class DEMO extends Component {
render() {
return (
<div>
<TooltipButton placement="bottomLeft" />
<TooltipButton placement="bottomLeft" style={{ border: "1px solid red" }} />
<TooltipButton placement="bottom" />
<TooltipButton placement="bottomRight" />
<hr />
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-widget-tooltip",
"version": "1.0.1",
"version": "1.0.2",
"description": "react-widget-tooltip",
"main": "cjs/index.js",
"module": "esm/index.js",
Expand Down Expand Up @@ -40,7 +40,7 @@
"@babel/runtime": "^7.9.2",
"classnames": "^2.2.6",
"dom-helpers-extra": "^0.2.1",
"react-widget-trigger": "^2.0.8"
"react-widget-trigger": "^2.0.10"
},
"author": "[email protected]",
"license": "MIT",
Expand Down
10 changes: 10 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ export interface TooltipProps
| "action"
| "popupTransition"
| "adjustPosition"
| "popupClassName"
| "popupStyle"
> {
/** 提示框样式 */
className?: string;
/** 提示框样式属性 */
style?: React.CSSProperties;
/** 提示文字 */
title?: React.ReactNode | (() => React.ReactNode);
/** 提示框位置,可选 top left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottom */
Expand Down Expand Up @@ -169,6 +175,8 @@ export class Tooltip extends React.Component<TooltipProps, TooltipState> {

render() {
const {
className,
style,
title,
visible,
defaultVisible,
Expand All @@ -188,6 +196,8 @@ export class Tooltip extends React.Component<TooltipProps, TooltipState> {
<Trigger
{...restProps}
ref={this.triggerRef}
popupClassName={className}
popupStyle={style}
popupTransition={this.getDefaultTransition()}
action={trigger}
adjustPosition={this.saveFeedback}
Expand Down

0 comments on commit 6a3a378

Please sign in to comment.