@sinco/react 1.1.1-rc.7 → 1.1.1-rc.8
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +24 -21
- package/package.json +1 -1
- package/src/lib/Hooks/useDynamicColor.d.ts +1 -1
package/index.js
CHANGED
@@ -20115,29 +20115,32 @@ const DynamicColor = async src => {
|
|
20115
20115
|
};
|
20116
20116
|
};
|
20117
20117
|
|
20118
|
-
const useDynamicColor =
|
20118
|
+
const useDynamicColor = url => {
|
20119
|
+
useState(AdproSincoTheme.palette.primary);
|
20120
|
+
useState(AdproSincoTheme.palette.secondary);
|
20121
|
+
useState(AdproSincoTheme.palette.background);
|
20122
|
+
const [primary, setPrimary] = useState(SincoTheme.palette.primary);
|
20123
|
+
const [secondary, setSecondary] = useState(SincoTheme.palette.secondary);
|
20124
|
+
const [background, setBackground] = useState(SincoTheme.palette.background);
|
20119
20125
|
const [loading, setLoading] = useState(false);
|
20120
20126
|
useEffect(() => {
|
20121
|
-
|
20122
|
-
|
20123
|
-
|
20124
|
-
|
20125
|
-
|
20126
|
-
|
20127
|
-
|
20128
|
-
|
20129
|
-
|
20130
|
-
|
20131
|
-
|
20132
|
-
|
20133
|
-
|
20134
|
-
|
20135
|
-
|
20136
|
-
|
20137
|
-
|
20138
|
-
};
|
20139
|
-
fetchDynamicColor();
|
20140
|
-
}, [url, theme]);
|
20127
|
+
DynamicColor(url).then(({
|
20128
|
+
primaryColor,
|
20129
|
+
secondaryColor,
|
20130
|
+
backgroundColor
|
20131
|
+
}) => {
|
20132
|
+
setPrimary(primaryColor);
|
20133
|
+
setSecondary(secondaryColor);
|
20134
|
+
setBackground(backgroundColor);
|
20135
|
+
setLoading(true);
|
20136
|
+
});
|
20137
|
+
}, [url]);
|
20138
|
+
SincoTheme.palette.primary = primary;
|
20139
|
+
SincoTheme.palette.secondary = secondary;
|
20140
|
+
SincoTheme.palette.background = background;
|
20141
|
+
AdproSincoTheme.palette.primary = primary;
|
20142
|
+
AdproSincoTheme.palette.secondary = secondary;
|
20143
|
+
AdproSincoTheme.palette.background = background;
|
20141
20144
|
return {
|
20142
20145
|
loading
|
20143
20146
|
};
|
package/package.json
CHANGED