@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 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: "26%"
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
- DynamicColor(url).then(({
20125
- primaryColor,
20126
- secondaryColor,
20127
- backgroundColor
20128
- }) => {
20129
- setPrimary(primaryColor);
20130
- setSecondary(secondaryColor);
20131
- setBackground(backgroundColor);
20132
- setLoading(true);
20133
- });
20134
- }, [url]);
20135
- SincoTheme.palette.primary = primary;
20136
- SincoTheme.palette.secondary = secondary;
20137
- SincoTheme.palette.background = background;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinco/react",
3
- "version": "1.1.1-rc.6",
3
+ "version": "1.1.1-rc.7",
4
4
  "description": "package for the configuration of mui react sinco",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -1,3 +1,3 @@
1
- export declare const useDynamicColor: (url: string) => {
1
+ export declare const useDynamicColor: (url: string, theme: any) => {
2
2
  loading: boolean;
3
3
  };