@gustavo-valsechi/client 1.3.50 → 1.3.52
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.
|
@@ -35,23 +35,10 @@ module.exports = __toCommonJS(avatar_exports);
|
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_styles = require("./styles");
|
|
38
|
-
var import_server = require("@gustavo-valsechi/server");
|
|
39
|
-
var import_randomcolor = __toESM(require("randomcolor"));
|
|
40
38
|
var import_lodash = __toESM(require("lodash"));
|
|
41
39
|
function Avatar(props) {
|
|
42
40
|
const containerRef = (0, import_react.useRef)({});
|
|
43
41
|
const [color, setColor] = (0, import_react.useState)("");
|
|
44
|
-
(0, import_react.useEffect)(() => {
|
|
45
|
-
if (color) return;
|
|
46
|
-
(async () => {
|
|
47
|
-
const storageKey = process.env.NEXT_PUBLIC_STORAGE_AVATAR;
|
|
48
|
-
const storageColor = await (0, import_server.getStorage)(storageKey);
|
|
49
|
-
if (storageColor) return setColor(storageColor);
|
|
50
|
-
const random = (0, import_randomcolor.default)({ luminosity: "light" });
|
|
51
|
-
await (0, import_server.setStorage)(storageKey, random);
|
|
52
|
-
setColor(random);
|
|
53
|
-
})();
|
|
54
|
-
}, [color]);
|
|
55
42
|
const name = () => {
|
|
56
43
|
const [first, secound] = import_lodash.default.split(props.name, " ") || [];
|
|
57
44
|
if (first && secound) return `${first} ${secound}`;
|
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
4
|
import { Container } from "./styles";
|
|
5
|
-
import { getStorage, setStorage } from "@gustavo-valsechi/server";
|
|
6
|
-
import randomColor from "randomcolor";
|
|
7
5
|
import _ from "lodash";
|
|
8
6
|
function Avatar(props) {
|
|
9
7
|
const containerRef = useRef({});
|
|
10
8
|
const [color, setColor] = useState("");
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (color) return;
|
|
13
|
-
(async () => {
|
|
14
|
-
const storageKey = process.env.NEXT_PUBLIC_STORAGE_AVATAR;
|
|
15
|
-
const storageColor = await getStorage(storageKey);
|
|
16
|
-
if (storageColor) return setColor(storageColor);
|
|
17
|
-
const random = randomColor({ luminosity: "light" });
|
|
18
|
-
await setStorage(storageKey, random);
|
|
19
|
-
setColor(random);
|
|
20
|
-
})();
|
|
21
|
-
}, [color]);
|
|
22
9
|
const name = () => {
|
|
23
10
|
const [first, secound] = _.split(props.name, " ") || [];
|
|
24
11
|
if (first && secound) return `${first} ${secound}`;
|
|
@@ -38,17 +38,12 @@ var import_react = require("react");
|
|
|
38
38
|
var import_styled_components = require("styled-components");
|
|
39
39
|
var import_styles = require("./styles");
|
|
40
40
|
var import_content = require("./content");
|
|
41
|
-
var import_server = require("@gustavo-valsechi/server");
|
|
42
41
|
var import_registry = __toESM(require("../../contexts/theme/registry"));
|
|
43
42
|
var import_global = __toESM(require("./global.styles"));
|
|
44
43
|
const ThemeContext = (0, import_react.createContext)({});
|
|
45
44
|
const ThemeProviderContainer = (props) => {
|
|
46
45
|
const [theme, setTheme] = (0, import_react.useState)("light");
|
|
47
46
|
const [defaultTheme] = (0, import_react.useState)("light");
|
|
48
|
-
(0, import_react.useEffect)(() => {
|
|
49
|
-
if (!theme) return;
|
|
50
|
-
(async () => await (0, import_server.setStorage)(process.env.NEXT_PUBLIC_STORAGE_THEME, theme))();
|
|
51
|
-
}, [theme]);
|
|
52
47
|
const SwitcherComponent = () => {
|
|
53
48
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
54
49
|
import_styles.Switcher,
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext,
|
|
3
|
+
import { createContext, useContext, useState } from "react";
|
|
4
4
|
import { ThemeProvider } from "styled-components";
|
|
5
5
|
import { Switcher } from "./styles";
|
|
6
6
|
import { Themes } from "./content";
|
|
7
|
-
import { setStorage } from "@gustavo-valsechi/server";
|
|
8
7
|
import StyledComponentsRegistry from "../../contexts/theme/registry";
|
|
9
8
|
import GlobalStyles from "./global.styles";
|
|
10
9
|
const ThemeContext = createContext({});
|
|
11
10
|
const ThemeProviderContainer = (props) => {
|
|
12
11
|
const [theme, setTheme] = useState("light");
|
|
13
12
|
const [defaultTheme] = useState("light");
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (!theme) return;
|
|
16
|
-
(async () => await setStorage(process.env.NEXT_PUBLIC_STORAGE_THEME, theme))();
|
|
17
|
-
}, [theme]);
|
|
18
13
|
const SwitcherComponent = () => {
|
|
19
14
|
return /* @__PURE__ */ jsxs(
|
|
20
15
|
Switcher,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gustavo-valsechi/client",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.52",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@emotion/is-prop-valid": "1.3.0",
|
|
27
|
-
"@gustavo-valsechi/server": "1.0.
|
|
27
|
+
"@gustavo-valsechi/server": "1.0.7",
|
|
28
28
|
"@hookform/resolvers": "5.2.2",
|
|
29
29
|
"apexcharts": "3.51.0",
|
|
30
30
|
"lodash": "4.17.21",
|