UNPKG

@blocklet/ui-react

Version:

Some useful front-end web components that can be used in Blocklets.

41 lines (40 loc) 1.02 kB
import { jsx as c } from "react/jsx-runtime"; import { createContext as w, useContext as a } from "react"; import { translate as p } from "@arcblock/ux/lib/Locale/util"; import { useMemoizedFn as x } from "ahooks"; import { useLocaleContext as U } from "@arcblock/ux/lib/Locale/context"; import d from "../hooks/use-follow.js"; import { translations as C } from "../UserCenter/libs/locales.js"; const e = w({ followed: !1, followUser: () => { }, unfollowUser: () => { } }), { Provider: F } = e; function g({ isMySelf: o, userDid: r, children: t }) { const { locale: s } = U(), l = x((i, u = {}) => p(C, i, s, "en", u)), { followed: n, followUser: f, unfollowUser: m } = d({ userDid: r, t: l, isMySelf: o }); return /* @__PURE__ */ c( F, { value: { followed: n, followUser: f, unfollowUser: m }, children: t } ); } function h() { return a(e); } export { e as UserFollowersContext, g as UserFollowersProvider, h as useUserFollowersContext };