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

refactor: remove TextWithTooltip with Tooltip #269

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions src/components/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import React, { ReactNode } from 'react';
import {
Text as DSText,
type TextProps,
TextWithTooltip,
type TextWithTooltipProps
Tooltip,
TooltipProps
} from '@zextras/carbonio-design-system';
import styled, { type SimpleInterpolation } from 'styled-components';

Expand All @@ -36,7 +36,7 @@ type StyledTextProps = {
};

type TextWithOptionalTooltipProps =
| ({ withTooltip: true } & MakeOptional<TextWithTooltipProps, 'children'>)
| ({ withTooltip: true } & MakeOptional<TooltipProps, 'children'>)
| ({ withTooltip?: boolean } & TextProps);

const TextWithOptionalTooltip = ({
Expand All @@ -45,7 +45,9 @@ const TextWithOptionalTooltip = ({
...rest
}: TextWithOptionalTooltipProps): React.JSX.Element =>
withTooltip ? (
<TextWithTooltip {...rest}>{children as ReactNode}</TextWithTooltip>
<Tooltip label={children as ReactNode} overflowTooltip>
<DSText {...rest}>{children as ReactNode}</DSText>
</Tooltip>
) : (
<DSText {...rest}>{children}</DSText>
);
Expand Down
6 changes: 4 additions & 2 deletions src/components/member-displayer-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import React, { useCallback, useMemo } from 'react';

import { Avatar, Button, Row, TextWithTooltip } from '@zextras/carbonio-design-system';
import { Avatar, Button, Row, Tooltip, Text } from '@zextras/carbonio-design-system';

import { useActionCopyToClipboard } from '../actions/copy-to-clipboard';
import { useActionSendEmail } from '../actions/send-email';
Expand Down Expand Up @@ -42,7 +42,9 @@ export const MemberDisplayerListItemComponent = ({
<Row wrap={'nowrap'} gap={'0.5rem'} flexShrink={1} minWidth={'1rem'}>
<Avatar size={'medium'} label={email} />
<Row flexShrink={1} minWidth={'1rem'}>
<TextWithTooltip size={'small'}>{email}</TextWithTooltip>
<Tooltip label={email} overflowTooltip>
<Text size={'small'}>{email}</Text>
</Tooltip>
</Row>
</Row>
<Row wrap={'nowrap'} gap={'0.25rem'} flexShrink={1} minWidth={'fit-content'}>
Expand Down
6 changes: 4 additions & 2 deletions src/components/member-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import React, { FC, useCallback } from 'react';

import { Avatar, Button, Row, TextWithTooltip } from '@zextras/carbonio-design-system';
import { Avatar, Button, Row, Tooltip, Text } from '@zextras/carbonio-design-system';
import { useTranslation } from 'react-i18next';

export type MemberListItemComponentProps = {
Expand All @@ -28,7 +28,9 @@ export const MemberListItemComponent: FC<MemberListItemComponentProps> = ({ emai
<Row wrap={'nowrap'} gap={'0.5rem'} flexShrink={1} minWidth={'1rem'}>
<Avatar size={'medium'} label={email} />
<Row flexShrink={1} minWidth={'1rem'}>
<TextWithTooltip size={'small'}>{email}</TextWithTooltip>
<Tooltip label={email} overflowTooltip>
<Text size={'small'}>{email}</Text>
</Tooltip>
</Row>
</Row>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
ListItem,
List,
Row,
TextWithTooltip
Tooltip,
Text
} from '@zextras/carbonio-design-system';
import { useTranslation } from 'react-i18next';

Expand Down Expand Up @@ -61,7 +62,9 @@ export const UsersSharesListItem: FC<UsersSharesListItemProps> = ({
data-testid={'shares-users-list-item'}
>
<Row wrap={'nowrap'} gap={'0.5rem'} flexShrink={1} minWidth={'1rem'}>
<TextWithTooltip>{label}</TextWithTooltip>
<Tooltip label={label} overflowTooltip>
<Text>{label}</Text>
</Tooltip>
</Row>
<IconButton
icon={expanded ? 'ChevronUp' : 'ChevronDown'}
Expand Down
9 changes: 6 additions & 3 deletions src/legacy/views/search/advance-filter-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import {
CustomModal,
Container,
Row,
TextWithTooltip,
Padding,
Icon
Icon,
Tooltip,
Text
} from '@zextras/carbonio-design-system';
import { getTags, SearchViewProps } from '@zextras/carbonio-shell-ui';
import { TFunction } from 'i18next';
Expand Down Expand Up @@ -61,7 +62,9 @@ const AdvancedFilterModal: FC<AdvancedFilterModalProps> = ({
</Padding>
</Row>
<Row takeAvailableSpace mainAlignment="flex-start">
<TextWithTooltip>{item.name}</TextWithTooltip>
<Tooltip label={item.name} overflowTooltip>
<Text>{item.name}</Text>
</Tooltip>
</Row>
</Row>
</Row>
Expand Down