@licklist/design 0.44.546 → 0.44.547

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,l=require("react-i18next"),i=require("../assets/iframe/available.svg.js"),n=require("../assets/iframe/limited.svg.js"),r=require("../assets/iframe/soldOut.svg.js"),o=function(e){var t=e.icon,l=e.label;return a.createElement("div",{className:"availability-indicator"},t,a.createElement("div",null,l))};exports.AvailabilityIndicator=function(e){var t=e.resources,s=e.isUnavailable,c=e.isSoldOut,u=l.useTranslation("Design").t;if(s)return a.createElement(o,{icon:r.ReactComponent,label:u("notAvailable")});if(c)return a.createElement(o,{icon:r.ReactComponent,label:u("soldOut")});var b=function(e){var t=e.bookedResources,a=e.totalResources;return t===a?{label:"soldOut",icon:r.ReactComponent}:t/a<=.2?{label:"lotsOfSpace",icon:i.ReactComponent}:t/a>=.8?{label:"limited",icon:n.ReactComponent}:{label:"available",icon:i.ReactComponent}}(t),m=b.icon,v=b.label;return a.createElement(o,{icon:m,label:u(v)})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,l=require("react-i18next"),n=require("../assets/iframe/available.svg.js"),r=require("../assets/iframe/limited.svg.js"),o=require("../assets/iframe/soldOut.svg.js"),i=function(e){var t=e.Icon,l=e.label;return a.createElement("div",{className:"availability-indicator"},a.createElement(t,null),a.createElement("div",null,l))};exports.AvailabilityIndicator=function(e){var t=e.resources,s=e.isUnavailable,c=e.isSoldOut,u=l.useTranslation("Design").t;if(s)return a.createElement(i,{Icon:o.ReactComponent,label:u("notAvailable")});if(c)return a.createElement(i,{Icon:o.ReactComponent,label:u("soldOut")});var b=function(e){var t=e.bookedResources,a=e.totalResources;return t===a?{label:"soldOut",Icon:o.ReactComponent}:t/a<=.2?{label:"lotsOfSpace",Icon:n.ReactComponent}:t/a>=.8?{label:"limited",Icon:r.ReactComponent}:{label:"available",Icon:n.ReactComponent}}(t),m=b.Icon,v=b.label;return a.createElement(i,{Icon:m,label:u(v)})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.546",
3
+ "version": "0.44.547",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -10,7 +10,7 @@ const LIMITED_LIMIT = 0.8;
10
10
 
11
11
  type Config = {
12
12
  label: string;
13
- icon: FunctionComponent<SVGProps<SVGSVGElement>>;
13
+ Icon: FunctionComponent<SVGProps<SVGSVGElement>>;
14
14
  };
15
15
 
16
16
  const getIconsAndLabels = ({
@@ -18,19 +18,19 @@ const getIconsAndLabels = ({
18
18
  totalResources,
19
19
  }: ZoneResourcesAvailability): Config => {
20
20
  if (bookedResources === totalResources) {
21
- return { label: "soldOut", icon: SoldOutIcon };
21
+ return { label: "soldOut", Icon: SoldOutIcon };
22
22
  }
23
23
 
24
24
  // lots of space if less than 80% booked
25
25
  if (bookedResources / totalResources <= LOTS_OF_SPACE_LIMIT) {
26
- return { label: "lotsOfSpace", icon: AvailableIcon };
26
+ return { label: "lotsOfSpace", Icon: AvailableIcon };
27
27
  }
28
28
 
29
29
  if (bookedResources / totalResources >= LIMITED_LIMIT) {
30
- return { label: "limited", icon: LimitedIcon };
30
+ return { label: "limited", Icon: LimitedIcon };
31
31
  }
32
32
 
33
- return { label: "available", icon: AvailableIcon };
33
+ return { label: "available", Icon: AvailableIcon };
34
34
  };
35
35
 
36
36
  type AvailabilityIndicatorProps = {
@@ -47,21 +47,21 @@ export const AvailabilityIndicator = ({
47
47
  const { t } = useTranslation("Design");
48
48
 
49
49
  if (isUnavailable) {
50
- return <Indicator icon={SoldOutIcon} label={t("notAvailable")} />;
50
+ return <Indicator Icon={SoldOutIcon} label={t("notAvailable")} />;
51
51
  }
52
52
 
53
53
  if (isSoldOut) {
54
- return <Indicator icon={SoldOutIcon} label={t("soldOut")} />;
54
+ return <Indicator Icon={SoldOutIcon} label={t("soldOut")} />;
55
55
  }
56
56
 
57
- const { icon, label } = getIconsAndLabels(resources);
57
+ const { Icon, label } = getIconsAndLabels(resources);
58
58
 
59
- return <Indicator icon={icon} label={t(label)} />;
59
+ return <Indicator Icon={Icon} label={t(label)} />;
60
60
  };
61
61
 
62
- const Indicator = ({ icon, label }: Config) => (
62
+ const Indicator = ({ Icon, label }: Config) => (
63
63
  <div className="availability-indicator">
64
- {icon}
64
+ <Icon />
65
65
  <div>{label}</div>
66
66
  </div>
67
67
  );