@sinco/react 1.1.1-rc.6 → 1.1.1-rc.7
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/index.js +22 -19
- package/package.json +1 -1
- package/src/lib/Hooks/useDynamicColor.d.ts +1 -1
package/index.js
CHANGED
@@ -6997,7 +6997,7 @@ const components = {
|
|
6997
6997
|
},
|
6998
6998
|
icon: {
|
6999
6999
|
color: (_palette$action = palette.action) == null ? void 0 : _palette$action.active,
|
7000
|
-
opacity: "
|
7000
|
+
opacity: "70%"
|
7001
7001
|
},
|
7002
7002
|
root: {
|
7003
7003
|
fontFamily: 'Roboto',
|
@@ -20115,26 +20115,29 @@ const DynamicColor = async src => {
|
|
20115
20115
|
};
|
20116
20116
|
};
|
20117
20117
|
|
20118
|
-
const useDynamicColor = url => {
|
20119
|
-
const [primary, setPrimary] = useState(SincoTheme.palette.primary);
|
20120
|
-
const [secondary, setSecondary] = useState(SincoTheme.palette.secondary);
|
20121
|
-
const [background, setBackground] = useState(SincoTheme.palette.background);
|
20118
|
+
const useDynamicColor = (url, theme) => {
|
20122
20119
|
const [loading, setLoading] = useState(false);
|
20123
20120
|
useEffect(() => {
|
20124
|
-
|
20125
|
-
|
20126
|
-
|
20127
|
-
|
20128
|
-
|
20129
|
-
|
20130
|
-
|
20131
|
-
|
20132
|
-
|
20133
|
-
|
20134
|
-
|
20135
|
-
|
20136
|
-
|
20137
|
-
|
20121
|
+
const fetchDynamicColor = () => {
|
20122
|
+
const dynamicColorPromise = DynamicColor(url);
|
20123
|
+
dynamicColorPromise.then(({
|
20124
|
+
primaryColor,
|
20125
|
+
secondaryColor,
|
20126
|
+
backgroundColor
|
20127
|
+
}) => {
|
20128
|
+
const updatedTheme = Object.assign({}, theme, {
|
20129
|
+
palette: Object.assign({}, theme.palette, {
|
20130
|
+
primary: primaryColor,
|
20131
|
+
secondary: secondaryColor,
|
20132
|
+
background: backgroundColor
|
20133
|
+
})
|
20134
|
+
});
|
20135
|
+
theme.setTheme(updatedTheme);
|
20136
|
+
setLoading(true);
|
20137
|
+
});
|
20138
|
+
};
|
20139
|
+
fetchDynamicColor();
|
20140
|
+
}, [url, theme]);
|
20138
20141
|
return {
|
20139
20142
|
loading
|
20140
20143
|
};
|
package/package.json
CHANGED