Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(SharePopover): add tooltipContentClassName prop #133

Merged
merged 1 commit into from
Dec 28, 2023
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
33 changes: 17 additions & 16 deletions src/components/SharePopover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ Sharing component

### PropTypes

| Property | Type | Required | Default | Description |
| :--------------- | :-------------------- | :------- | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| url | `String` | ✔ | | share link |
| title | `String` | | | link title |
| text | `String` | | | link text |
| shareOptions | `Array<ShareOptions>` | | `[]` | share options list |
| withCopyLink | `Boolean` | | `true` | display copy button |
| useWebShareApi | `Boolean` | | `false` | [Web Share API](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share) usage setting. If turned on default share dialog will be shown (if bbrowser supports it) |
| placement | `Array` | | `['bottom-end']` | tooltip openening direction |
| openByHover | `Boolean` | | `true` | should open tooltip with hover |
| autoclosable | `Boolean` | | `true` | should close tooltip when cursor is outside |
| closeDelay | `Number` | | `300` | delay before tooltip will be hidden when cursor is otside |
| iconSize | `Number` | | | icon-control size |
| iconClass | `String` | | | icon-control mixin |
| tooltipClassName | `String` | | | tooltip mixin |
| className | `String` | | | css class for control |
| Property | Type | Required | Default | Description |
| :---------------------- | :-------------------- | :------- | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| url | `String` | ✔ | | share link |
| title | `String` | | | link title |
| text | `String` | | | link text |
| shareOptions | `Array<ShareOptions>` | | `[]` | share options list |
| withCopyLink | `Boolean` | | `true` | display copy button |
| useWebShareApi | `Boolean` | | `false` | [Web Share API](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share) usage setting. If turned on default share dialog will be shown (if bbrowser supports it) |
| placement | `Array` | | `['bottom-end']` | tooltip openening direction |
| openByHover | `Boolean` | | `true` | should open tooltip with hover |
| autoclosable | `Boolean` | | `true` | should close tooltip when cursor is outside |
| closeDelay | `Number` | | `300` | delay before tooltip will be hidden when cursor is otside |
| iconSize | `Number` | | | icon-control size |
| iconClass | `String` | | | icon-control mixin |
| tooltipClassName | `String` | | | tooltip mixin |
| tooltipContentClassName | `String` | | | tooltip content mixin |
| className | `String` | | | css class for control |

### Examples

Expand Down
3 changes: 2 additions & 1 deletion src/components/SharePopover/SharePopover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ $block: '.#{variables.$ns}share-popover';
padding: 8px;
}

&__tooltip-content {
// for guaranteed popover style override
#{$block} &__tooltip-content {
max-width: none;
}

Expand Down
5 changes: 4 additions & 1 deletion src/components/SharePopover/SharePopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export interface SharePopoverProps extends ShareListProps, Partial<SharePopoverD
iconClass?: string;
/** tooltip mixin */
tooltipClassName?: string;
/** tooltip content mixin */
tooltipContentClassName?: string;
/** sitcher mixin */
switcherClassName?: string;
/** custom icon */
Expand Down Expand Up @@ -90,6 +92,7 @@ export const SharePopover = (props: SharePopoverProps) => {
iconSize = sharePopoverDefaultProps.iconSize,
iconClass,
tooltipClassName,
tooltipContentClassName,
switcherClassName,
className,
direction = sharePopoverDefaultProps.direction,
Expand Down Expand Up @@ -160,7 +163,7 @@ export const SharePopover = (props: SharePopoverProps) => {
content={content}
className={b(null, className)}
tooltipClassName={b('tooltip', tooltipClassName)}
tooltipContentClassName={b('tooltip-content')}
tooltipContentClassName={b('tooltip-content', tooltipContentClassName)}
onClick={handleClick}
tooltipId={tooltipId}
disablePortal
Expand Down