use better colors for light mode hanger spinner

Initially the spinner was only used in OutfitPreview, where the background was always pretty dark. Now that we use it in more general contexts, we need a light/dark distinction!

Also went and standardized out the `size` props
This commit is contained in:
Emi Matchu 2020-09-10 03:06:44 -07:00
parent 93564ee6bd
commit 9cb6cc2120
4 changed files with 22 additions and 14 deletions

View file

@ -33,7 +33,7 @@ function ItemsPage() {
if (loading) { if (loading) {
return ( return (
<Box display="flex" justifyContent="center"> <Box display="flex" justifyContent="center">
<HangerSpinner boxSize="48px" /> <HangerSpinner />
</Box> </Box>
); );
} }

View file

@ -61,7 +61,7 @@ function PosePickerSupport({
if (loading) { if (loading) {
return ( return (
<Box display="flex" justifyContent="center"> <Box display="flex" justifyContent="center">
<HangerSpinner boxSize="32px" /> <HangerSpinner size="sm" />
</Box> </Box>
); );
} }

View file

@ -1,6 +1,6 @@
import * as React from "react"; import * as React from "react";
import { css } from "emotion"; import { css } from "emotion";
import { Box } from "@chakra-ui/core"; import { Box, useColorModeValue } from "@chakra-ui/core";
import { createIcon } from "@chakra-ui/icons"; import { createIcon } from "@chakra-ui/icons";
const HangerIcon = createIcon({ const HangerIcon = createIcon({
@ -18,6 +18,7 @@ const HangerIcon = createIcon({
function HangerSpinner({ size = "md", ...props }) { function HangerSpinner({ size = "md", ...props }) {
const boxSize = { sm: "32px", md: "48px" }[size]; const boxSize = { sm: "32px", md: "48px" }[size];
const color = useColorModeValue("green.500", "green.300");
return ( return (
<> <>
@ -85,7 +86,12 @@ function HangerSpinner({ size = "md", ...props }) {
`} `}
{...props} {...props}
> >
<HangerIcon color="green.300" boxSize={boxSize} {...props} /> <HangerIcon
boxSize={boxSize}
color={color}
transition="color 0.2s"
{...props}
/>
</Box> </Box>
</> </>
); );

View file

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { css, cx } from "emotion"; import { css, cx } from "emotion";
import { CSSTransition, TransitionGroup } from "react-transition-group"; import { CSSTransition, TransitionGroup } from "react-transition-group";
import { Box, Flex, Text } from "@chakra-ui/core"; import { Box, Flex, DarkMode, Text } from "@chakra-ui/core";
import { WarningIcon } from "@chakra-ui/icons"; import { WarningIcon } from "@chakra-ui/icons";
import HangerSpinner from "./HangerSpinner"; import HangerSpinner from "./HangerSpinner";
@ -45,7 +45,7 @@ function OutfitPreview({
if (error || error2) { if (error || error2) {
return ( return (
<FullScreenCenter> <FullScreenCenter>
<Text color="gray.50" d="flex" alignItems="center"> <Text color="green.50" d="flex" alignItems="center">
<WarningIcon /> <WarningIcon />
<Box width={2} /> <Box width={2} />
Could not load preview. Try again? Could not load preview. Try again?
@ -55,6 +55,7 @@ function OutfitPreview({
} }
return ( return (
<DarkMode>
<OutfitLayers <OutfitLayers
loading={loading || loading2} loading={loading || loading2}
visibleLayers={loadedLayers} visibleLayers={loadedLayers}
@ -62,6 +63,7 @@ function OutfitPreview({
loadingDelay={loadingDelay} loadingDelay={loadingDelay}
doAnimations doAnimations
/> />
</DarkMode>
); );
} }
@ -179,7 +181,7 @@ export function OutfitLayers({
backgroundColor="gray.900" backgroundColor="gray.900"
opacity="0.7" opacity="0.7"
/> />
<HangerSpinner boxSize="48px" /> <HangerSpinner />
</FullScreenCenter> </FullScreenCenter>
</Box> </Box>
); );