contentoh-components-library 21.3.92 → 21.3.94

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.
Files changed (153) hide show
  1. package/.env.development +0 -5
  2. package/.env.production +0 -3
  3. package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
  4. package/dist/components/atoms/Avatar/index.js +2 -3
  5. package/dist/components/atoms/Card/index.js +5 -46
  6. package/dist/components/atoms/Card/styles.js +1 -3
  7. package/dist/components/atoms/CheckBox/index.js +2 -7
  8. package/dist/components/atoms/CheckBox/styles.js +1 -1
  9. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  10. package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
  11. package/dist/components/molecules/HeaderTop/index.js +11 -68
  12. package/dist/components/molecules/TabsMenu/index.js +13 -7
  13. package/dist/components/molecules/TagAndInput/index.js +1 -1
  14. package/dist/components/organisms/Chat/Chat.stories.js +8 -27
  15. package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
  16. package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
  17. package/dist/components/organisms/Chat/ContentChat/index.js +197 -350
  18. package/dist/components/organisms/Chat/Footer/index.js +39 -48
  19. package/dist/components/organisms/Chat/index.js +4 -49
  20. package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
  21. package/dist/components/organisms/FullTabsMenu/index.js +3 -1
  22. package/dist/components/organisms/Modal/styles.js +1 -1
  23. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +96 -171
  24. package/dist/components/pages/ProviderProductEdition/index.js +178 -190
  25. package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
  26. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +52 -77
  27. package/dist/components/pages/RetailerProductEdition/index.js +276 -290
  28. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  29. package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
  30. package/dist/index.js +52 -182
  31. package/package.json +1 -4
  32. package/src/components/atoms/Avatar/index.js +2 -8
  33. package/src/components/atoms/Card/index.js +2 -35
  34. package/src/components/atoms/Card/styles.js +5 -41
  35. package/src/components/atoms/CheckBox/index.js +1 -4
  36. package/src/components/atoms/CheckBox/styles.js +0 -2
  37. package/src/components/atoms/InputFormatter/styles.js +1 -2
  38. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  39. package/src/components/molecules/HeaderTop/index.js +6 -52
  40. package/src/components/molecules/TabsMenu/index.js +16 -10
  41. package/src/components/molecules/TagAndInput/index.js +8 -10
  42. package/src/components/organisms/Chat/Chat.stories.js +7 -27
  43. package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
  44. package/src/components/organisms/Chat/ContainerItems/styles.js +2 -10
  45. package/src/components/organisms/Chat/ContentChat/index.js +12 -88
  46. package/src/components/organisms/Chat/Footer/index.js +0 -11
  47. package/src/components/organisms/Chat/index.js +4 -46
  48. package/src/components/organisms/FullProductNameHeader/index.js +1 -1
  49. package/src/components/organisms/FullTabsMenu/index.js +3 -1
  50. package/src/components/organisms/Modal/styles.js +1 -4
  51. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +98 -181
  52. package/src/components/pages/ProviderProductEdition/index.js +132 -134
  53. package/src/components/pages/ProviderProductEdition/styles.js +1 -5
  54. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +46 -76
  55. package/src/components/pages/RetailerProductEdition/index.js +138 -123
  56. package/src/components/pages/RetailerProductEdition/styles.js +0 -4
  57. package/src/components/pages/RetailerProductEdition/utils.js +0 -37
  58. package/src/index.js +0 -11
  59. package/dist/components/atoms/ImageCarousel/ImgeSlider.stories.js +0 -90
  60. package/dist/components/atoms/ImageCarousel/index.js +0 -123
  61. package/dist/components/atoms/ImageCarousel/styles.js +0 -18
  62. package/dist/components/atoms/PercentTag/PercentTag.stories.js +0 -31
  63. package/dist/components/atoms/PercentTag/index.js +0 -23
  64. package/dist/components/atoms/PercentTag/styles.js +0 -22
  65. package/dist/components/atoms/RatingStars/RatingStars.stories.js +0 -30
  66. package/dist/components/atoms/RatingStars/index.js +0 -53
  67. package/dist/components/atoms/RatingStars/styles.js +0 -18
  68. package/dist/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +0 -48
  69. package/dist/components/atoms/RetailerCatalog/index.js +0 -69
  70. package/dist/components/atoms/RetailerCatalog/styles.js +0 -20
  71. package/dist/components/atoms/RetailerOption/RetailerOption.stories.js +0 -33
  72. package/dist/components/atoms/RetailerOption/index.js +0 -62
  73. package/dist/components/atoms/RetailerOption/styles.js +0 -20
  74. package/dist/components/atoms/RetailersList/RetailersList.stories.js +0 -45
  75. package/dist/components/atoms/RetailersList/index.js +0 -44
  76. package/dist/components/atoms/RetailersList/styles.js +0 -18
  77. package/dist/components/atoms/UserCatalog/UserCatalog.stories.js +0 -72
  78. package/dist/components/atoms/UserCatalog/index.js +0 -89
  79. package/dist/components/atoms/UserCatalog/styles.js +0 -18
  80. package/dist/components/atoms/UserOption/UserOption.stories.js +0 -40
  81. package/dist/components/atoms/UserOption/index.js +0 -80
  82. package/dist/components/atoms/UserOption/styles.js +0 -20
  83. package/dist/components/atoms/UserSelector/UserSelector.stories.js +0 -40
  84. package/dist/components/atoms/UserSelector/index.js +0 -91
  85. package/dist/components/atoms/UserSelector/styles.js +0 -32
  86. package/dist/components/molecules/GridItem/GridItem.stories.js +0 -123
  87. package/dist/components/molecules/GridItem/index.js +0 -122
  88. package/dist/components/molecules/GridItem/styles.js +0 -20
  89. package/dist/components/molecules/HeaderItem/ColumnItem.js +0 -23
  90. package/dist/components/molecules/HeaderItem/HeaderItem.stories.js +0 -70
  91. package/dist/components/molecules/HeaderItem/index.js +0 -42
  92. package/dist/components/molecules/HeaderItem/styles.js +0 -30
  93. package/dist/components/molecules/RowItem/ColumnItem.js +0 -23
  94. package/dist/components/molecules/RowItem/RowItem.stories.js +0 -5242
  95. package/dist/components/molecules/RowItem/index.js +0 -59
  96. package/dist/components/molecules/RowItem/styles.js +0 -30
  97. package/dist/components/organisms/GridProducts/GridProducts.stories.js +0 -5093
  98. package/dist/components/organisms/GridProducts/index.js +0 -81
  99. package/dist/components/organisms/GridProducts/styles.js +0 -18
  100. package/dist/components/organisms/GridProducts/utils.js +0 -139
  101. package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +0 -76
  102. package/src/components/atoms/ImageCarousel/index.js +0 -103
  103. package/src/components/atoms/ImageCarousel/styles.js +0 -79
  104. package/src/components/atoms/PercentTag/PercentTag.stories.js +0 -7
  105. package/src/components/atoms/PercentTag/index.js +0 -9
  106. package/src/components/atoms/PercentTag/styles.js +0 -69
  107. package/src/components/atoms/RatingStars/RatingStars.stories.js +0 -10
  108. package/src/components/atoms/RatingStars/index.js +0 -31
  109. package/src/components/atoms/RatingStars/styles.js +0 -28
  110. package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +0 -36
  111. package/src/components/atoms/RetailerCatalog/index.js +0 -49
  112. package/src/components/atoms/RetailerCatalog/styles.js +0 -30
  113. package/src/components/atoms/RetailerOption/RetailerOption.stories.js +0 -15
  114. package/src/components/atoms/RetailerOption/index.js +0 -53
  115. package/src/components/atoms/RetailerOption/styles.js +0 -41
  116. package/src/components/atoms/RetailersList/RetailersList.stories.js +0 -33
  117. package/src/components/atoms/RetailersList/index.js +0 -20
  118. package/src/components/atoms/RetailersList/styles.js +0 -19
  119. package/src/components/atoms/UserCatalog/UserCatalog.stories.js +0 -66
  120. package/src/components/atoms/UserCatalog/index.js +0 -77
  121. package/src/components/atoms/UserCatalog/styles.js +0 -24
  122. package/src/components/atoms/UserOption/UserOption.stories.js +0 -25
  123. package/src/components/atoms/UserOption/index.js +0 -49
  124. package/src/components/atoms/UserOption/styles.js +0 -54
  125. package/src/components/atoms/UserSelector/UserSelector.stories.js +0 -25
  126. package/src/components/atoms/UserSelector/index.js +0 -70
  127. package/src/components/atoms/UserSelector/styles.js +0 -55
  128. package/src/components/molecules/GridItem/GridItem.stories.js +0 -126
  129. package/src/components/molecules/GridItem/index.js +0 -82
  130. package/src/components/molecules/GridItem/styles.js +0 -85
  131. package/src/components/molecules/HeaderItem/ColumnItem.js +0 -9
  132. package/src/components/molecules/HeaderItem/HeaderItem.stories.js +0 -24
  133. package/src/components/molecules/HeaderItem/index.js +0 -26
  134. package/src/components/molecules/HeaderItem/styles.js +0 -25
  135. package/src/components/molecules/RowItem/ColumnItem.js +0 -9
  136. package/src/components/molecules/RowItem/RowItem.stories.js +0 -5660
  137. package/src/components/molecules/RowItem/index.js +0 -45
  138. package/src/components/molecules/RowItem/styles.js +0 -38
  139. package/src/components/molecules/StripeCardForm/StripeCardForm.stories.js +0 -13
  140. package/src/components/molecules/StripeCardForm/index.js +0 -42
  141. package/src/components/molecules/StripeCardForm/paymentForm.js +0 -124
  142. package/src/components/molecules/StripeCardForm/styles.js +0 -73
  143. package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +0 -12
  144. package/src/components/molecules/StripeCardSelector/index.js +0 -44
  145. package/src/components/molecules/StripeCardSelector/styles.js +0 -4
  146. package/src/components/molecules/StripeCardSelector/utils.js +0 -17
  147. package/src/components/organisms/GridProducts/GridProducts.stories.js +0 -5474
  148. package/src/components/organisms/GridProducts/index.js +0 -59
  149. package/src/components/organisms/GridProducts/styles.js +0 -15
  150. package/src/components/organisms/GridProducts/utils.js +0 -103
  151. package/src/components/organisms/SideModal/SideModal.stories.js +0 -23
  152. package/src/components/organisms/SideModal/index.js +0 -50
  153. package/src/components/organisms/SideModal/styles.js +0 -30
@@ -1,49 +0,0 @@
1
- import { useState } from "react";
2
- import { Avatar } from "../Avatar";
3
- import { Container } from "./styles";
4
- import { useEffect } from "react";
5
- import { useCloseModal } from "../../../global-files/customHooks";
6
- import { RetailersList } from "../RetailersList";
7
-
8
- export const RetailerCatalog = ({
9
- retailers = [],
10
- limit = 3,
11
- article,
12
- id = "retailers-catalog",
13
- }) => {
14
- const [retLimit, setRetLimit] = useState(0);
15
- const [showRetailers, setShowRetailers] = useCloseModal(id);
16
-
17
- useEffect(() => {
18
- setRetLimit(limit);
19
- }, [retailers]);
20
-
21
- return (
22
- <Container
23
- id={id}
24
- onClick={() => {
25
- setShowRetailers(true);
26
- }}
27
- >
28
- {retailers.map(
29
- (retailer, i) =>
30
- i < limit && (
31
- <Avatar
32
- key={retailer.id + "-" + i}
33
- image={`https://content-management-images.s3.amazonaws.com/retailers/${retailer.id}.png`}
34
- altText={retailer?.name}
35
- imageType={"medium-image"}
36
- />
37
- )
38
- )}
39
- {retailers.length > retLimit && (
40
- <div className="retailers-limit">
41
- <p>+{retailers.length - retLimit}</p>
42
- </div>
43
- )}
44
- {showRetailers && (
45
- <RetailersList retailers={retailers} article={article} />
46
- )}
47
- </Container>
48
- );
49
- };
@@ -1,30 +0,0 @@
1
- import styled from "styled-components";
2
- import { FontFamily } from "../../../global-files/variables";
3
-
4
- export const Container = styled.div`
5
- display: flex;
6
- align-items: center;
7
- justify-content: center;
8
- cursor: pointer;
9
- position: relative;
10
- width: 100%;
11
-
12
- .retailers-limit {
13
- width: 26px;
14
- height: 26px;
15
- border-radius: 50%;
16
- background-color: #f0f0f0;
17
-
18
- p {
19
- font-family: ${FontFamily.Lato};
20
- font-size: 12px;
21
- line-height: 26px;
22
- color: #262626;
23
- text-align: center;
24
- }
25
- }
26
-
27
- > * + * {
28
- margin-left: -5px;
29
- }
30
- `;
@@ -1,15 +0,0 @@
1
- import { RetailerOption } from ".";
2
-
3
- export default {
4
- title: "Components/atoms/RetailerOptions",
5
- component: RetailerOption,
6
- };
7
-
8
- const Template = (args) => <RetailerOption {...args} />;
9
- export const RetailerOptionDefault = Template.bind({});
10
- RetailerOptionDefault.args = {
11
- retailer: {
12
- id: 58,
13
- name: "The Home Depot Golden",
14
- },
15
- };
@@ -1,53 +0,0 @@
1
- import { useState } from "react";
2
- import { Avatar } from "../Avatar";
3
- import { Container } from "./styles";
4
- import { useEffect } from "react";
5
-
6
- export const RetailerOption = ({ retailer, services = {} }) => {
7
- const [service, setService] = useState([]);
8
-
9
- useEffect(() => {
10
- if (services[retailer.id]) {
11
- setService(Object.keys(services[retailer.id]));
12
- }
13
- }, [services]);
14
-
15
- return (
16
- <Container>
17
- <div className="avatar-and-retailer">
18
- <Avatar
19
- image={`https://content-management-images.s3.amazonaws.com/retailers/${retailer.id}.png`}
20
- altText={retailer?.name}
21
- imageType={"medium-image"}
22
- />
23
- <p className="retailer-name">{retailer?.name}</p>
24
- </div>
25
- <div className="services-icons">
26
- <span
27
- key="datasheet"
28
- className={`material-icons small ${
29
- service.includes("datasheet") && "is-active"
30
- }`}
31
- >
32
- &#xf8ee;
33
- </span>
34
- <span
35
- key="description"
36
- className={`material-icons small ${
37
- service.includes("description") && "is-active"
38
- }`}
39
- >
40
- &#xe873;
41
- </span>
42
- <span
43
- key="images"
44
- className={`material-icons small ${
45
- service.includes("images") && "is-active"
46
- }`}
47
- >
48
- &#xe3f4;
49
- </span>
50
- </div>
51
- </Container>
52
- );
53
- };
@@ -1,41 +0,0 @@
1
- import styled from "styled-components";
2
- import { FontFamily } from "../../../global-files/variables";
3
-
4
- export const Container = styled.div`
5
- display: flex;
6
- padding: 7px;
7
- border: 1px solid #f0f0f0;
8
- align-items: center;
9
- justify-content: space-between;
10
- border-radius: 5px;
11
-
12
- .avatar-and-retailer {
13
- display: flex;
14
- align-items: center;
15
- .retailer-name {
16
- font-family: ${FontFamily.Lato};
17
- font-size: 12px;
18
- color: #262626;
19
- }
20
-
21
- > * + * {
22
- margin-left: 10px;
23
- }
24
- }
25
-
26
- .services-icons {
27
- display: flex;
28
-
29
- span {
30
- color: #f0f0f0;
31
- font-size: 14px;
32
- &.is-active {
33
- color: #8a6caa;
34
- }
35
- }
36
-
37
- > * + * {
38
- margin-left: 9px;
39
- }
40
- }
41
- `;
@@ -1,33 +0,0 @@
1
- import { RetailersList } from ".";
2
-
3
- export default {
4
- title: "Components/atoms/RetailersList",
5
- component: RetailersList,
6
- };
7
-
8
- const Template = (args) => <RetailersList {...args} />;
9
- export const RetailersListDefault = Template.bind({});
10
- RetailersListDefault.args = {
11
- retailers: [
12
- {
13
- id: 58,
14
- name: "The Home Depot Golden",
15
- },
16
- {
17
- id: 59,
18
- name: "The Home Depot Platinum",
19
- },
20
- {
21
- id: 60,
22
- name: "The Home Depot Resizing",
23
- },
24
- {
25
- id: 61,
26
- name: "Home Depot TAB",
27
- },
28
- {
29
- id: 68,
30
- name: "The Home Depot Dropship",
31
- },
32
- ],
33
- };
@@ -1,20 +0,0 @@
1
- import { Container } from "./styles";
2
- import { RetailerOption } from "../RetailerOption";
3
- import { useState, useEffect } from "react";
4
- import axios from "axios";
5
-
6
- export const RetailersList = ({ retailers, article }) => {
7
- const [services, setServices] = useState({});
8
-
9
- useEffect(() => {
10
- if (article) setServices(article.statusByRetailer);
11
- }, [article]);
12
-
13
- return (
14
- <Container>
15
- {retailers.map((retailer, i) => (
16
- <RetailerOption key={i} retailer={retailer} services={services} />
17
- ))}
18
- </Container>
19
- );
20
- };
@@ -1,19 +0,0 @@
1
- import styled from "styled-components";
2
-
3
- export const Container = styled.div`
4
- width: 370px;
5
- max-height: 200px;
6
- overflow: auto;
7
- position: absolute;
8
- z-index: 500;
9
- right: 0%;
10
- top: 100%;
11
- border: 1px solid #f0f0f0;
12
- padding: 10px;
13
- padding-right: 5px;
14
- background-color: white;
15
-
16
- > * + * {
17
- margin-top: 5px;
18
- }
19
- `;
@@ -1,66 +0,0 @@
1
- import { UserCatalog } from ".";
2
-
3
- export default {
4
- title: "Components/atoms/UserCatalog",
5
- component: UserCatalog,
6
- };
7
-
8
- const Template = (args) => <UserCatalog {...args} />;
9
- export const UserCatalogDefault = Template.bind({});
10
- UserCatalogDefault.args = {
11
- datasheet: 54,
12
- description: 54,
13
- images: 55,
14
- auditor: 37,
15
- auditors: [
16
- {
17
- name: "José",
18
- last_name: "Castañeda",
19
- id_user: 37,
20
- },
21
- {
22
- name: "Eduardo ",
23
- last_name: " Reyes",
24
- id_user: 195,
25
- },
26
- ],
27
- textSpecialists: [
28
- {
29
- name: "Especialista",
30
- last_name: "Textos",
31
- id_user: 36,
32
- },
33
- {
34
- name: "ESPECIALISTA TXTS PRUEBA",
35
- last_name: "",
36
- id_user: 54,
37
- },
38
- {
39
- name: "Gerson",
40
- last_name: "Martínez",
41
- id_user: 57,
42
- },
43
- {
44
- name: "Angel",
45
- last_name: "Perea",
46
- id_user: 232,
47
- },
48
- ],
49
- imagesSpecialists: [
50
- {
51
- name: "Especialista",
52
- last_name: "Imágenes",
53
- id_user: 35,
54
- },
55
- {
56
- name: "ESPECIALISTA ED PRUEBA",
57
- last_name: "",
58
- id_user: 55,
59
- },
60
- {
61
- name: "Uriel",
62
- last_name: "Herrera",
63
- id_user: 196,
64
- },
65
- ],
66
- };
@@ -1,77 +0,0 @@
1
- import { Container } from "./styles";
2
- import { Avatar } from "../Avatar";
3
- import { getProfilePicture } from "../../../global-files/data";
4
- import { UserOption } from "../UserOption";
5
- import { useState } from "react";
6
- import { useCloseModal } from "../../../global-files/customHooks";
7
- import { useEffect } from "react";
8
-
9
- export const UserCatalog = ({
10
- datasheet,
11
- description,
12
- images,
13
- auditor,
14
- auditors = [],
15
- textSpecialists = [],
16
- imagesSpecialists = [],
17
- id = "list-modal",
18
- }) => {
19
- const [showList, setShowList] = useCloseModal(id);
20
-
21
- return (
22
- <Container onClick={() => setShowList(true)} id={id}>
23
- {datasheet && (
24
- <Avatar
25
- image={getProfilePicture(datasheet, 26, 26)}
26
- altText={"datasheet specialist"}
27
- imageType={"medium-image"}
28
- />
29
- )}
30
- {description && (
31
- <Avatar
32
- image={getProfilePicture(description, 26, 26)}
33
- altText={"description specialist"}
34
- imageType={"medium-image"}
35
- />
36
- )}
37
- {images && (
38
- <Avatar
39
- image={getProfilePicture(images, 26, 26)}
40
- altText={"images specialist"}
41
- imageType={"medium-image"}
42
- />
43
- )}
44
- {auditor && (
45
- <Avatar
46
- image={getProfilePicture(auditor, 26, 26)}
47
- altText={"auditor"}
48
- imageType={"medium-image"}
49
- />
50
- )}
51
- {showList && (
52
- <div className="users-assigned-list">
53
- <UserOption
54
- userId={datasheet}
55
- usersArray={textSpecialists}
56
- id={id + "-" + datasheet}
57
- />
58
- <UserOption
59
- userId={description}
60
- usersArray={textSpecialists}
61
- id={id + "-" + description}
62
- />
63
- <UserOption
64
- userId={images}
65
- usersArray={imagesSpecialists}
66
- id={id + "-" + images}
67
- />
68
- <UserOption
69
- userId={auditor}
70
- usersArray={auditors}
71
- id={id + "-" + auditor}
72
- />
73
- </div>
74
- )}
75
- </Container>
76
- );
77
- };
@@ -1,24 +0,0 @@
1
- import styled from "styled-components";
2
-
3
- export const Container = styled.div`
4
- display: flex;
5
- justify-content: center;
6
- width: 100%;
7
- height: 100%;
8
- cursor: pointer;
9
- position: relative;
10
-
11
- .users-assigned-list {
12
- background-color: white;
13
- padding: 10px;
14
- box-shadow: 0px 2px 4px #00000040;
15
- position: absolute;
16
- top: 100%;
17
- left: 0;
18
- z-index: 400;
19
- }
20
-
21
- > * + * {
22
- margin-left: -10px;
23
- }
24
- `;
@@ -1,25 +0,0 @@
1
- import { UserOption } from ".";
2
-
3
- export default {
4
- title: "Components/atoms/UserOption",
5
- component: UserOption,
6
- };
7
-
8
- const Template = (args) => <UserOption {...args} />;
9
- export const UserOptionDefault = Template.bind({});
10
- UserOptionDefault.args = {
11
- userId: 37,
12
- index: "datasheet",
13
- usersArray: [
14
- {
15
- name: "José",
16
- last_name: "Castañeda",
17
- id_user: 37,
18
- },
19
- {
20
- name: "Eduardo ",
21
- last_name: " Reyes",
22
- id_user: 195,
23
- },
24
- ],
25
- };
@@ -1,49 +0,0 @@
1
- import { Container } from "./styles";
2
- import { Avatar } from "../Avatar";
3
- import { useState } from "react";
4
- import { useEffect } from "react";
5
- import { getProfilePicture } from "../../../global-files/data";
6
- import { servicesCodeIcon } from "../../organisms/OrderDetail/utils/Table/utils";
7
- import { UserSelector } from "../UserSelector";
8
- import { useCloseModal } from "../../../global-files/customHooks";
9
-
10
- export const UserOption = ({ userId, index, usersArray, id }) => {
11
- const [userAssigned, setUserAssigned] = useState({});
12
- const [showSelector, setShowSelector] = useCloseModal(id);
13
- const icons = servicesCodeIcon;
14
-
15
- useEffect(() => {
16
- if (usersArray) {
17
- usersArray.forEach((user) => {
18
- if (user.id_user === userId) {
19
- setUserAssigned(user);
20
- }
21
- });
22
- }
23
- }, [userId, usersArray]);
24
-
25
- return (
26
- <Container onClick={() => setShowSelector(true)}>
27
- <div className="image-and-name">
28
- <Avatar
29
- image={getProfilePicture(userAssigned?.id_user, 26, 26)}
30
- altText={"datasheet specialist"}
31
- imageType={"medium-image"}
32
- />
33
- <p>
34
- {userAssigned?.name} {userAssigned?.last_name}
35
- </p>
36
- </div>
37
- <div className="icon-container">{icons[index]}</div>
38
- {showSelector && (
39
- <UserSelector
40
- id={id}
41
- searchLabel="Buscar Usuario"
42
- index={index}
43
- usersArray={usersArray}
44
- position="absolute"
45
- />
46
- )}
47
- </Container>
48
- );
49
- };
@@ -1,54 +0,0 @@
1
- import styled from "styled-components";
2
- import { FontFamily } from "../../../global-files/variables";
3
-
4
- export const Container = styled.div`
5
- border: 1px solid #f0f0f0;
6
- border-radius: 5px;
7
- color: #262626;
8
- font-size: 12px;
9
- font-family: ${FontFamily.Lato};
10
- display: flex;
11
- align-items: center;
12
- padding: 5px 10px;
13
- justify-content: space-between;
14
- cursor: pointer;
15
- position: relative;
16
- background-color: white;
17
- width: 217px;
18
-
19
- .image-and-name {
20
- display: flex;
21
- align-items: center;
22
-
23
- div + p {
24
- margin-left: 10px;
25
- }
26
- }
27
-
28
- .icon-container {
29
- position: relative;
30
- span {
31
- color: #808080;
32
- cursor: pointer;
33
-
34
- & + span {
35
- display: none;
36
- position: absolute;
37
- right: 120%;
38
- top: 50%;
39
- transform: translateY(-50%);
40
- white-space: nowrap;
41
- }
42
-
43
- &:hover {
44
- & + span {
45
- display: block;
46
- }
47
- }
48
- }
49
- }
50
-
51
- & + * {
52
- margin-top: 5px;
53
- }
54
- `;
@@ -1,25 +0,0 @@
1
- import { UserSelector } from ".";
2
-
3
- export default {
4
- title: "Components/atoms/UserSelector",
5
- component: UserSelector,
6
- };
7
-
8
- const Template = (args) => <UserSelector {...args} />;
9
- export const UserSelectorDefault = Template.bind({});
10
- UserSelectorDefault.args = {
11
- searchLabel: "Buscar auditor",
12
- index: "auditor",
13
- usersArray: [
14
- {
15
- name: "José",
16
- last_name: "Castañeda",
17
- id_user: 37,
18
- },
19
- {
20
- name: "Eduardo ",
21
- last_name: " Reyes",
22
- id_user: 195,
23
- },
24
- ],
25
- };
@@ -1,70 +0,0 @@
1
- import { Container } from "./styles";
2
- import { faSearch } from "@fortawesome/free-solid-svg-icons";
3
- import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome";
4
- import { Avatar } from "../Avatar";
5
- import { getProfilePicture } from "../../../global-files/data";
6
- import { useState } from "react";
7
- import { useEffect } from "react";
8
-
9
- export const UserSelector = ({
10
- searchLabel,
11
- index,
12
- usersArray,
13
- onClick,
14
- position,
15
- }) => {
16
- const [text, setText] = useState([]);
17
- const [userFiltered, setUsersFiltered] = useState([]);
18
-
19
- useEffect(() => {
20
- if (usersArray) setUsersFiltered(usersArray);
21
- }, [usersArray]);
22
-
23
- const onChangeText = (e) => {
24
- setText(e.target.value);
25
- if (usersArray)
26
- setUsersFiltered(
27
- usersArray.filter((user) =>
28
- (user.name + " " + user.last_name)
29
- .toLowerCase()
30
- .includes(e.target.value.toLowerCase())
31
- )
32
- );
33
- };
34
-
35
- return (
36
- <Container position={position}>
37
- <div className="search-cotainer">
38
- <Icon icon={faSearch} />
39
- <input
40
- type="text"
41
- className="search"
42
- placeholder={searchLabel}
43
- value={text}
44
- onChange={onChangeText}
45
- autoFocus
46
- />
47
- </div>
48
- <div className="selector-container">
49
- {userFiltered.length ? (
50
- userFiltered.map((user) => (
51
- <div key={user.id_user} className="user-item" onClick={onClick}>
52
- <Avatar
53
- image={getProfilePicture(user.id_user, 26, 26)}
54
- altText={"profile image"}
55
- imageType={"medium-image"}
56
- />
57
- <p>
58
- {user.name} {user.last_name}
59
- </p>
60
- </div>
61
- ))
62
- ) : (
63
- <div>
64
- <p>Sin usuarios para asignar</p>
65
- </div>
66
- )}
67
- </div>
68
- </Container>
69
- );
70
- };