github.com/minio/console@v1.4.1/web-app/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/IconWithLabel.tsx (about) 1 // This file is part of MinIO Console Server 2 // Copyright (c) 2021 MinIO, Inc. 3 // 4 // This program is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Affero General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Affero General Public License for more details. 13 // 14 // You should have received a copy of the GNU Affero General Public License 15 // along with this program. If not, see <http://www.gnu.org/licenses/>. 16 17 // This object contains variables that will be used across form components. 18 19 import React from "react"; 20 import { Box } from "mds"; 21 import { replaceUnicodeChar } from "../../../../../../common/utils"; 22 23 interface IIconWithLabel { 24 icon: React.ReactNode; 25 strings: string[]; 26 } 27 28 const IconWithLabel = ({ icon, strings }: IIconWithLabel) => { 29 return ( 30 <Box 31 sx={{ 32 display: "flex", 33 alignItems: "center", 34 "& .min-icon": { 35 width: 16, 36 height: 16, 37 marginRight: 4, 38 minWidth: 16, 39 minHeight: 16, 40 }, 41 "& .fileNameText": { 42 whiteSpace: "pre", 43 overflow: "hidden", 44 textOverflow: "ellipsis", 45 }, 46 }} 47 > 48 {icon} 49 <span className={"fileNameText"}> 50 {replaceUnicodeChar(strings[strings.length - 1])} 51 </span> 52 </Box> 53 ); 54 }; 55 56 export default IconWithLabel;