@sinco/react 1.1.1-rc.7 → 1.1.1-rc.8

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
@@ -20115,29 +20115,32 @@ const DynamicColor = async src => {
20115
20115
  };
20116
20116
  };
20117
20117
 
20118
- const useDynamicColor = (url, theme) => {
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
- 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]);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinco/react",
3
- "version": "1.1.1-rc.7",
3
+ "version": "1.1.1-rc.8",
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, theme: any) => {
1
+ export declare const useDynamicColor: (url: string) => {
2
2
  loading: boolean;
3
3
  };