allaw-ui 2.7.4 → 2.7.5
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.
|
@@ -7,25 +7,23 @@ var OAuthProviderButton = function (_a) {
|
|
|
7
7
|
var buttonRef = useRef(null);
|
|
8
8
|
var getLabels = function () {
|
|
9
9
|
var labels = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
login: {
|
|
11
|
+
google: "Se connecter avec Google",
|
|
12
|
+
apple: "Se connecter avec Apple",
|
|
13
|
+
linkedin: "Se connecter avec LinkedIn",
|
|
14
|
+
microsoft: "Se connecter avec Microsoft",
|
|
14
15
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
signup: {
|
|
17
|
+
google: "S'inscrire avec Google",
|
|
18
|
+
apple: "S'inscrire avec Apple",
|
|
19
|
+
linkedin: "S'inscrire avec LinkedIn",
|
|
20
|
+
microsoft: "S'inscrire avec Microsoft",
|
|
19
21
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
microsoft: {
|
|
26
|
-
login: "Continuer avec Microsoft",
|
|
27
|
-
signup: "S'inscrire avec Microsoft",
|
|
28
|
-
calendar: "Microsoft Outlook",
|
|
22
|
+
calendar: {
|
|
23
|
+
google: "Connecter Google Calendar",
|
|
24
|
+
apple: "Connecter Apple Calendar",
|
|
25
|
+
linkedin: "Connecter LinkedIn",
|
|
26
|
+
microsoft: "Connecter Microsoft Calendar",
|
|
29
27
|
},
|
|
30
28
|
};
|
|
31
29
|
var shortLabels = {
|
|
@@ -54,39 +52,30 @@ var OAuthProviderButton = function (_a) {
|
|
|
54
52
|
return 250;
|
|
55
53
|
}
|
|
56
54
|
};
|
|
57
|
-
var updateLabel = function () {
|
|
58
|
-
var _a, _b;
|
|
59
|
-
var _c = getLabels(), labels = _c.labels, shortLabels = _c.shortLabels;
|
|
60
|
-
if (!labels[provider][type]) {
|
|
61
|
-
console.warn("Type \"".concat(type, "\" non pris en charge pour le provider \"").concat(provider, "\"."));
|
|
62
|
-
setLabel("Type inconnu");
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
var maxWidth = (_b = (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) !== null && _b !== void 0 ? _b : 0;
|
|
66
|
-
var thresholdWidth = getThresholdWidth(size);
|
|
67
|
-
var newLabel = maxWidth < thresholdWidth
|
|
68
|
-
? shortLabels[provider]
|
|
69
|
-
: labels[provider][type];
|
|
70
|
-
setLabel(newLabel);
|
|
71
|
-
};
|
|
72
55
|
useEffect(function () {
|
|
73
|
-
|
|
56
|
+
updateLabel();
|
|
57
|
+
var timer = setTimeout(function () {
|
|
74
58
|
updateLabel();
|
|
75
|
-
});
|
|
59
|
+
}, 50);
|
|
60
|
+
return function () { return clearTimeout(timer); };
|
|
61
|
+
}, []);
|
|
62
|
+
var updateLabel = function () {
|
|
63
|
+
var _a = getLabels(), labels = _a.labels, shortLabels = _a.shortLabels;
|
|
64
|
+
var thresholdWidth = getThresholdWidth(size);
|
|
76
65
|
if (buttonRef.current) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
var buttonWidth = buttonRef.current.offsetWidth;
|
|
67
|
+
if (!label) {
|
|
68
|
+
setLabel(labels[type][provider]);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (buttonWidth < thresholdWidth) {
|
|
72
|
+
setLabel(shortLabels[provider]);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
setLabel(labels[type][provider]);
|
|
82
76
|
}
|
|
83
|
-
};
|
|
84
|
-
}, [provider, type, size]);
|
|
85
|
-
useEffect(function () {
|
|
86
|
-
if (buttonRef.current) {
|
|
87
|
-
updateLabel();
|
|
88
77
|
}
|
|
89
|
-
}
|
|
78
|
+
};
|
|
90
79
|
var renderIcon = function () {
|
|
91
80
|
var iconSizes = {
|
|
92
81
|
google: type === "calendar" ? size * 1.1 : size * 0.8,
|