sprint-asia-custom-component 0.1.132 → 0.1.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -23900,24 +23900,48 @@
23900
23900
  })));
23901
23901
  };
23902
23902
 
23903
+ // THIS FILE IS AUTO GENERATED
23904
+ function FaFileAlt(props){return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 384 512"},"child":[{"tag":"path","attr":{"d":"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm64 236c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-64c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12v8zm0-72v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm96-114.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"}}]})(props);}function FaFileImage(props){return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 384 512"},"child":[{"tag":"path","attr":{"d":"M384 121.941V128H256V0h6.059a24 24 0 0 1 16.97 7.029l97.941 97.941a24.002 24.002 0 0 1 7.03 16.971zM248 160c-13.2 0-24-10.8-24-24V0H24C10.745 0 0 10.745 0 24v464c0 13.255 10.745 24 24 24h336c13.255 0 24-10.745 24-24V160H248zm-135.455 16c26.51 0 48 21.49 48 48s-21.49 48-48 48-48-21.49-48-48 21.491-48 48-48zm208 240h-256l.485-48.485L104.545 328c4.686-4.686 11.799-4.201 16.485.485L160.545 368 264.06 264.485c4.686-4.686 12.284-4.686 16.971 0L320.545 304v112z"}}]})(props);}
23905
+
23903
23906
  const DescriptionFile = ({
23904
23907
  title = "Title",
23905
- link
23908
+ link,
23909
+ fileName
23906
23910
  }) => {
23911
+ const getFileIcon = fileName => {
23912
+ const ext = fileName.split(".").pop().toLowerCase();
23913
+ switch (ext) {
23914
+ case "pdf":
23915
+ return /*#__PURE__*/React__default["default"].createElement(PiFilePdf, {
23916
+ className: "text-black",
23917
+ size: 16
23918
+ });
23919
+ case "png":
23920
+ case "jpg":
23921
+ case "jpeg":
23922
+ return /*#__PURE__*/React__default["default"].createElement(FaFileImage, {
23923
+ className: "text-black",
23924
+ size: 16
23925
+ });
23926
+ default:
23927
+ return /*#__PURE__*/React__default["default"].createElement(FaFileAlt, {
23928
+ className: "text-black",
23929
+ size: 16
23930
+ });
23931
+ }
23932
+ };
23907
23933
  return /*#__PURE__*/React__default["default"].createElement("div", {
23908
23934
  className: "w-full"
23909
23935
  }, title && /*#__PURE__*/React__default["default"].createElement("p", {
23910
23936
  className: "text-sm font-normal text-black mb-1 py-2"
23911
23937
  }, title), /*#__PURE__*/React__default["default"].createElement("div", {
23912
23938
  className: "flex items-center cursor-pointer"
23913
- }, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(PiFilePdf, {
23914
- className: "text-black",
23915
- size: 16
23916
- })), /*#__PURE__*/React__default["default"].createElement("a", {
23939
+ }, /*#__PURE__*/React__default["default"].createElement("div", null, getFileIcon(fileName || title)), /*#__PURE__*/React__default["default"].createElement("a", {
23917
23940
  className: "text-md font-semibold text-base ml-1",
23918
- href: link ? link : null,
23919
- target: "_blank"
23920
- }, link ? title + ".pdf" : "Loading...")));
23941
+ href: link || "#",
23942
+ target: "_blank",
23943
+ rel: "noopener noreferrer"
23944
+ }, fileName || title)));
23921
23945
  };
23922
23946
 
23923
23947
  const DropdownCard = ({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sprint-asia-custom-component",
3
3
  "main": "dist/index.js",
4
- "version": "0.1.132",
4
+ "version": "0.1.134",
5
5
  "private": false,
6
6
  "dependencies": {
7
7
  "@headlessui/react": "^1.7.18",
@@ -1,21 +1,40 @@
1
- import React from 'react';
2
- import { PiFilePdf } from 'react-icons/pi';
1
+ import React from "react";
2
+ import { PiFilePdf } from "react-icons/pi";
3
+ import { FaFileImage } from "react-icons/fa";
4
+ import { FaFileAlt } from "react-icons/fa";
5
+
6
+ const DescriptionFile = ({ title = "Title", link, fileName }) => {
7
+ const getFileIcon = (fileName) => {
8
+ const ext = fileName.split(".").pop().toLowerCase();
9
+
10
+ switch (ext) {
11
+ case "pdf":
12
+ return <PiFilePdf className="text-black" size={16} />;
13
+ case "png":
14
+ case "jpg":
15
+ case "jpeg":
16
+ return <FaFileImage className="text-black" size={16} />;
17
+ default:
18
+ return <FaFileAlt className="text-black" size={16} />;
19
+ }
20
+ };
3
21
 
4
- const DescriptionFile = ({
5
- title = "Title",
6
- link
7
- }) => {
8
22
  return (
9
- <div className='w-full'>
10
- {title && <p className="text-sm font-normal text-black mb-1 py-2">{title}</p>}
11
- <div className='flex items-center cursor-pointer'>
12
- <div>
13
- <PiFilePdf className='text-black' size={16}/>
14
- </div>
15
- <a className='text-md font-semibold text-base ml-1' href={link ? link : null} target="_blank">{link ? title+".pdf" : "Loading..."}</a>
16
- </div>
23
+ <div className="w-full">
24
+ {title && <p className="text-sm font-normal text-black mb-1 py-2">{title}</p>}
25
+ <div className="flex items-center cursor-pointer">
26
+ <div>{getFileIcon(fileName || title)}</div>
27
+ <a
28
+ className="text-md font-semibold text-base ml-1"
29
+ href={link || "#"}
30
+ target="_blank"
31
+ rel="noopener noreferrer"
32
+ >
33
+ {fileName || title}
34
+ </a>
35
+ </div>
17
36
  </div>
18
37
  );
19
38
  };
20
39
 
21
- export default DescriptionFile;
40
+ export default DescriptionFile;
@@ -60,6 +60,7 @@ import CellModelFive from "../components/table/listTable/cellmodefive";
60
60
  import CellModelSix from "../components/table/listTable/cellmodesix";
61
61
  import CellModelSeven from "../components/table/listTable/cellmodelseven";
62
62
  import CustomPhone from "../components/customphone";
63
+ import DescriptionFile from "../components/description/file";
63
64
 
64
65
  const Templates = () => {
65
66
  const [startDate, setStartDate] = useState(null);
@@ -838,6 +839,14 @@ const Templates = () => {
838
839
 
839
840
  return (
840
841
  <div>
842
+ <DescriptionFile
843
+ title="Project Brief"
844
+ link={
845
+ "http://192.168.4.224:8080/api/division/files/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRJZCI6IjlhOGM4ZTU1LWM3YzctNDEwZS1iNzYwLTVlZWI4NmI4YzVkMyIsImNsaWVudE5hbWUiOiJNYXN0ZXIgQ2xpZW50IiwiZGl2aXNpb25JZCI6IjljMmM2Y2NiLWZlZGUtNDJmZi1hMzc1LTE0ZWNjOTY5OWExMSIsImRpdmlzaW9uTmFtZSI6Ik1hc3RlciBEaXZpc2lvbiIsImV4cCI6MTczNjI2MzI2NSwicm9sZUlkIjoiMTk5ZWMxODItZjBjMy0xMWVlLTkzMzYtZGMxYmExNGE1YmY5IiwidXNlcklkIjoiNjlkNTUwNTUtYmY5NS00YjBkLWJkZWMtYjY1YTI0MWFiNjRmIiwidXNlck5hbWUiOiJoYW5keSBudWdyYWhhIn0.bfqIMzp-htu0-CWDRakgOem-c9Hn_2u6MfqgEMCPq54/61820a4c-f102-4dc1-a8bc-6c2956a333a5.pdf"
846
+ }
847
+ fileName="61820a4c-f102-4dc1-a8bc-6c2956a333a5.pdf"
848
+ />
849
+
841
850
  <div>
842
851
  {/* <OutlineButton title="Test" /> */}
843
852
  <Header title="Navbar" roleName="System Administrators" dataBalance={10000} />