refactor: enhance icon transition handling and improve Zustand store proxy functionality
Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -44,13 +44,11 @@ const createIconTransition =
|
||||
exit={exit}
|
||||
/>
|
||||
) : (
|
||||
cloneElement(icon1, {
|
||||
className: cn(icon1ClassName, className),
|
||||
key: "1",
|
||||
initial,
|
||||
animate,
|
||||
exit,
|
||||
})
|
||||
<m.span key="1" initial={initial} animate={animate} exit={exit}>
|
||||
{cloneElement(icon1, {
|
||||
className: cn(icon1ClassName, className),
|
||||
})}
|
||||
</m.span>
|
||||
)
|
||||
) : typeof icon2 === "string" ? (
|
||||
<m.i
|
||||
@@ -61,13 +59,11 @@ const createIconTransition =
|
||||
exit={exit}
|
||||
/>
|
||||
) : (
|
||||
cloneElement(icon2, {
|
||||
className: cn(icon2ClassName, className),
|
||||
key: "2",
|
||||
initial,
|
||||
animate,
|
||||
exit,
|
||||
})
|
||||
<m.span key="2" initial={initial} animate={animate} exit={exit}>
|
||||
{cloneElement(icon2, {
|
||||
className: cn(icon2ClassName, className),
|
||||
})}
|
||||
</m.span>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
)
|
||||
|
||||
@@ -60,7 +60,16 @@ export const createZustandStore =
|
||||
{
|
||||
get(_, prop) {
|
||||
if (prop in storeMap) {
|
||||
return storeMap[prop as string].getState()
|
||||
return new Proxy(() => {}, {
|
||||
get() {
|
||||
return storeMap[prop as string].getState()
|
||||
},
|
||||
apply(target, thisArg, argumentsList) {
|
||||
return storeMap[prop as string].setState(
|
||||
produce(storeMap[prop as string].getState(), ...argumentsList),
|
||||
)
|
||||
},
|
||||
})
|
||||
}
|
||||
return
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user