Skip to content

Commit

Permalink
[Card]: add tooltip position prop (#931)
Browse files Browse the repository at this point in the history
* chore: add tooltip position to card

* chore: add changeset file
  • Loading branch information
AbhinavMV committed Dec 5, 2022
1 parent ff60d20 commit 420680f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/plenty-penguins-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@web3uikit/core': patch
---

A tooltip position to card element
1 change: 1 addition & 0 deletions packages/core/src/lib/Card/Card.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ NftCollection.args = {
children: [<div key={'0'}>{getModuleAnimation('NFT Collection')}</div>],
title: 'NFT Collection',
description: 'Create and publish your own NFT Collection',
tooltipPosition: 'right',
};

export const Disabled = Template.bind({});
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/lib/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const Card: React.FC<CardProps> = ({
tooltipMove,
tooltipMoveBody,
tooltipText,
tooltipPosition = 'bottom',
style,
...props
}: CardProps) => {
Expand Down Expand Up @@ -67,7 +68,7 @@ const Card: React.FC<CardProps> = ({
content={tooltipText}
move={tooltipMove}
moveBody={tooltipMoveBody}
position={'bottom'}
position={tooltipPosition}
/>
</AbsoluteIconStyled>
)}
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/lib/Card/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ReactNode, CSSProperties } from 'react';
import { TooltipProps } from '../Tooltip';
export interface CardProps {
/**
* set the ID of Card
Expand Down Expand Up @@ -65,6 +66,11 @@ export interface CardProps {
* Optional custom CSS
*/
style?: CSSProperties;

/**
* Add position to card tooltip
*/
tooltipPosition?: TooltipProps['position'];
}

export interface AbsoluteIconStyledProps {
Expand Down

0 comments on commit 420680f

Please sign in to comment.