Skip to content

Commit 6bf6ce5

Browse files
authored
Merge pull request #1982 from dxc-technology/Mil4n0r/tooltip-fileitem
Added custom tooltip to `FileInput`
2 parents 068a224 + e12976e commit 6bf6ce5

File tree

1 file changed

+7
-40
lines changed

1 file changed

+7
-40
lines changed

packages/lib/src/file-input/FileItem.tsx

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import useTheme from "../useTheme";
55
import useTranslatedLabels from "../useTranslatedLabels";
66
import { FileItemProps } from "./types";
77
import DxcIcon from "../icon/Icon";
8+
import DxcTooltip from "../tooltip/Tooltip";
9+
import DxcActionIcon from "../action-icon/ActionIcon";
810

911
const FileItem = ({
1012
fileName = "",
@@ -44,17 +46,12 @@ const FileItem = ({
4446
<DxcIcon icon="filled_error" />
4547
</ErrorIcon>
4648
)}
47-
<DeleteFileAction
48-
onClick={() => {
49-
onDelete(fileName);
50-
}}
51-
type="button"
52-
title={translatedLabels.fileInput.deleteFileActionTitle}
53-
aria-label={translatedLabels.fileInput.deleteFileActionTitle}
49+
<DxcActionIcon
50+
onClick={() => onDelete(fileName)}
51+
icon="close"
5452
tabIndex={tabIndex}
55-
>
56-
<DxcIcon icon="close" />
57-
</DeleteFileAction>
53+
title={translatedLabels.fileInput.deleteFileActionTitle}
54+
/>
5855
</DxcFlex>
5956
{error && !singleFileMode && (
6057
<ErrorMessage role="alert" aria-live="assertive">
@@ -145,36 +142,6 @@ const ErrorIcon = styled.span`
145142
color: #d0011b;
146143
`;
147144

148-
const DeleteFileAction = styled.button`
149-
display: flex;
150-
flex-wrap: wrap;
151-
align-content: center;
152-
justify-content: center;
153-
height: 24px;
154-
width: 24px;
155-
font-size: 1rem;
156-
font-family: ${(props) => props.theme.fontFamily};
157-
border: 1px solid transparent;
158-
border-radius: 2px;
159-
background-color: transparent;
160-
box-shadow: 0 0 0 2px transparent;
161-
padding: 3px;
162-
cursor: pointer;
163-
color: ${(props) => props.theme.deleteFileItemColor};
164-
font-size: 18px;
165-
&:hover {
166-
background-color: ${(props) => props.theme.hoverDeleteFileItemBackgroundColor};
167-
}
168-
&:focus,
169-
&:focus-visible {
170-
outline: none;
171-
box-shadow: 0 0 0 2px ${(props) => props.theme.focusDeleteFileItemBorderColor};
172-
}
173-
&:active {
174-
background-color: ${(props) => props.theme.activeDeleteFileItemBackgroundColor};
175-
}
176-
`;
177-
178145
const ErrorMessage = styled.span`
179146
color: ${(props) => props.theme.errorMessageFontColor};
180147
font-family: ${(props) => props.theme.errorMessageFontFamily};

0 commit comments

Comments
 (0)