fix fade-in for outfit loading hanger
Huh, maybe this is a Firefox bug or something? but the container wasn't applying partial opacity correctly to its children, it was only doing 0 or 1, I think maybe because the children weren't static? I refactor here to make the DOM structure a bit more natural, and fade ins work again 🤷♀️
This commit is contained in:
parent
41388ecb9d
commit
f6b9f7f440
1 changed files with 17 additions and 17 deletions
|
@ -77,8 +77,8 @@ export function OutfitLayers({
|
|||
doAnimations = false,
|
||||
}) {
|
||||
const [isMounted, setIsMounted] = React.useState(false);
|
||||
React.useEffect(() => {
|
||||
setTimeout(() => setIsMounted(true), 0);
|
||||
React.useLayoutEffect(() => {
|
||||
setIsMounted(true);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
@ -158,7 +158,8 @@ export function OutfitLayers({
|
|||
</CSSTransition>
|
||||
))}
|
||||
</TransitionGroup>
|
||||
<Box
|
||||
<FullScreenCenter
|
||||
zIndex="9000"
|
||||
// This is similar to our Delay util component, but Delay disappears
|
||||
// immediately on load, whereas we want this to fade out smoothly. We
|
||||
// also delay the fade-in by 0.5s, but don't delay the fade-out at all.
|
||||
|
@ -169,23 +170,22 @@ export function OutfitLayers({
|
|||
opacity={isMounted && loading ? 1 : 0}
|
||||
transition={`opacity 0.2s ${loading ? loadingDelay : "0s"}`}
|
||||
>
|
||||
<FullScreenCenter zIndex="9000">
|
||||
<Box
|
||||
width="100%"
|
||||
height="100%"
|
||||
position="absolute"
|
||||
top="0"
|
||||
left="0"
|
||||
right="0"
|
||||
bottom="0"
|
||||
backgroundColor="gray.900"
|
||||
opacity="0.8"
|
||||
opacity="0.7"
|
||||
/>
|
||||
</FullScreenCenter>
|
||||
<FullScreenCenter zIndex="9001">
|
||||
<HangerSpinner boxSize="48px" />
|
||||
</FullScreenCenter>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export function FullScreenCenter({ children, zIndex }) {
|
||||
export function FullScreenCenter({ children, ...otherProps }) {
|
||||
return (
|
||||
<Flex
|
||||
pos="absolute"
|
||||
|
@ -195,7 +195,7 @@ export function FullScreenCenter({ children, zIndex }) {
|
|||
left="0"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
zIndex={zIndex}
|
||||
{...otherProps}
|
||||
>
|
||||
{children}
|
||||
</Flex>
|
||||
|
|
Loading…
Reference in a new issue