upgrade to Chakra v1
it's a preview version, but it has a feature I want, so let's get ahead of the curve!
This commit is contained in:
parent
ac12f6bb55
commit
419a270df9
10 changed files with 743 additions and 273 deletions
|
@ -5,9 +5,9 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/react-hooks": "^3.1.5",
|
"@apollo/react-hooks": "^3.1.5",
|
||||||
"@apollographql/graphql-playground-html": "^1.6.24",
|
"@apollographql/graphql-playground-html": "^1.6.24",
|
||||||
"@chakra-ui/core": "^0.7.0",
|
"@chakra-ui/core": "^1.0.0-next.6",
|
||||||
"@emotion/core": "^10.0.28",
|
"@chakra-ui/icons": "^1.0.0-next.6",
|
||||||
"@emotion/styled": "^10.0.27",
|
"@chakra-ui/theme": "^1.0.0-next.6",
|
||||||
"@loadable/component": "^5.12.0",
|
"@loadable/component": "^5.12.0",
|
||||||
"@testing-library/jest-dom": "^4.2.4",
|
"@testing-library/jest-dom": "^4.2.4",
|
||||||
"@testing-library/react": "^9.3.2",
|
"@testing-library/react": "^9.3.2",
|
||||||
|
@ -19,7 +19,6 @@
|
||||||
"apollo-server-env": "^2.4.3",
|
"apollo-server-env": "^2.4.3",
|
||||||
"dataloader": "^2.0.0",
|
"dataloader": "^2.0.0",
|
||||||
"emotion": "^10.0.27",
|
"emotion": "^10.0.27",
|
||||||
"emotion-theming": "^10.0.27",
|
|
||||||
"graphql": "^15.0.0",
|
"graphql": "^15.0.0",
|
||||||
"immer": "^6.0.3",
|
"immer": "^6.0.3",
|
||||||
"mysql2": "^2.1.0",
|
"mysql2": "^2.1.0",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { ApolloProvider } from "@apollo/react-hooks";
|
import { ApolloProvider } from "@apollo/react-hooks";
|
||||||
import { CSSReset, ThemeProvider, theme } from "@chakra-ui/core";
|
import { CSSReset, ChakraProvider } from "@chakra-ui/core";
|
||||||
|
import theme from "@chakra-ui/theme";
|
||||||
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
|
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
|
||||||
import loadable from "@loadable/component";
|
import loadable from "@loadable/component";
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ function App() {
|
||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
<ApolloProvider client={apolloClient}>
|
<ApolloProvider client={apolloClient}>
|
||||||
<ThemeProvider theme={theme}>
|
<ChakraProvider theme={theme}>
|
||||||
<CSSReset />
|
<CSSReset />
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/outfits/new">
|
<Route path="/outfits/new">
|
||||||
|
@ -29,7 +30,7 @@ function App() {
|
||||||
<HomePage />
|
<HomePage />
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</ThemeProvider>
|
</ChakraProvider>
|
||||||
</ApolloProvider>
|
</ApolloProvider>
|
||||||
</Router>
|
</Router>
|
||||||
);
|
);
|
||||||
|
|
|
@ -30,7 +30,7 @@ function HomePage() {
|
||||||
alt=""
|
alt=""
|
||||||
width="200px"
|
width="200px"
|
||||||
height="200px"
|
height="200px"
|
||||||
rounded="lg"
|
borderRadius="lg"
|
||||||
boxShadow="md"
|
boxShadow="md"
|
||||||
/>
|
/>
|
||||||
<Box height="4" />
|
<Box height="4" />
|
||||||
|
@ -94,7 +94,7 @@ function StartOutfitForm() {
|
||||||
<Box width="4" />
|
<Box width="4" />
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
variantColor="green"
|
colorScheme="green"
|
||||||
disabled={!isValid}
|
disabled={!isValid}
|
||||||
backgroundColor="green.600" // for AA contrast
|
backgroundColor="green.600" // for AA contrast
|
||||||
_hover={{ backgroundColor: "green.700" }}
|
_hover={{ backgroundColor: "green.700" }}
|
||||||
|
@ -189,7 +189,7 @@ function SubmitPetForm() {
|
||||||
<Box width="4" />
|
<Box width="4" />
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
variantColor="green"
|
colorScheme="green"
|
||||||
isDisabled={!petName}
|
isDisabled={!petName}
|
||||||
isLoading={loading}
|
isLoading={loading}
|
||||||
backgroundColor="green.600" // for AA contrast
|
backgroundColor="green.600" // for AA contrast
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@chakra-ui/core";
|
} from "@chakra-ui/core";
|
||||||
|
import { DeleteIcon, InfoIcon } from "@chakra-ui/icons";
|
||||||
|
|
||||||
import { safeImageUrl } from "./util";
|
import { safeImageUrl } from "./util";
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ export function Item({ item, itemNameId, outfitState, dispatchToOutfit }) {
|
||||||
<Box flexGrow="1" />
|
<Box flexGrow="1" />
|
||||||
<Box>
|
<Box>
|
||||||
<ItemActionButton
|
<ItemActionButton
|
||||||
icon="info"
|
icon={<InfoIcon />}
|
||||||
label="More info"
|
label="More info"
|
||||||
href={`http://impress.openneo.net/items/${
|
href={`http://impress.openneo.net/items/${
|
||||||
item.id
|
item.id
|
||||||
|
@ -50,7 +51,7 @@ export function Item({ item, itemNameId, outfitState, dispatchToOutfit }) {
|
||||||
/>
|
/>
|
||||||
{isInOutfit && (
|
{isInOutfit && (
|
||||||
<ItemActionButton
|
<ItemActionButton
|
||||||
icon="delete"
|
icon={<DeleteIcon />}
|
||||||
label="Remove"
|
label="Remove"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
dispatchToOutfit({ type: "removeItem", itemId: item.id })
|
dispatchToOutfit({ type: "removeItem", itemId: item.id })
|
||||||
|
@ -89,7 +90,7 @@ function ItemContainer({ children }) {
|
||||||
<Box
|
<Box
|
||||||
p="1"
|
p="1"
|
||||||
my="1"
|
my="1"
|
||||||
rounded="lg"
|
borderRadius="lg"
|
||||||
d="flex"
|
d="flex"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
cursor="pointer"
|
cursor="pointer"
|
||||||
|
@ -126,7 +127,7 @@ function ItemThumbnail({ src, isWorn }) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
rounded="lg"
|
borderRadius="lg"
|
||||||
boxShadow="md"
|
boxShadow="md"
|
||||||
border="1px"
|
border="1px"
|
||||||
width="50px"
|
width="50px"
|
||||||
|
|
|
@ -2,13 +2,13 @@ import React from "react";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Flex,
|
Flex,
|
||||||
Icon,
|
|
||||||
IconButton,
|
IconButton,
|
||||||
Input,
|
Input,
|
||||||
InputGroup,
|
InputGroup,
|
||||||
InputLeftElement,
|
InputLeftElement,
|
||||||
InputRightElement,
|
InputRightElement,
|
||||||
} from "@chakra-ui/core";
|
} from "@chakra-ui/core";
|
||||||
|
import { CloseIcon, SearchIcon } from "@chakra-ui/icons";
|
||||||
|
|
||||||
import ItemsPanel from "./ItemsPanel";
|
import ItemsPanel from "./ItemsPanel";
|
||||||
import SearchPanel from "./SearchPanel";
|
import SearchPanel from "./SearchPanel";
|
||||||
|
@ -106,7 +106,7 @@ function SearchToolbar({
|
||||||
return (
|
return (
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
<InputLeftElement>
|
<InputLeftElement>
|
||||||
<Icon name="search" color="gray.400" />
|
<SearchIcon color="gray.400" />
|
||||||
</InputLeftElement>
|
</InputLeftElement>
|
||||||
<Input
|
<Input
|
||||||
placeholder="Search for items to add…"
|
placeholder="Search for items to add…"
|
||||||
|
@ -128,10 +128,10 @@ function SearchToolbar({
|
||||||
{query && (
|
{query && (
|
||||||
<InputRightElement>
|
<InputRightElement>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon="close"
|
icon={<CloseIcon />}
|
||||||
color="gray.400"
|
color="gray.400"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
variantColor="green"
|
colorScheme="green"
|
||||||
aria-label="Clear search"
|
aria-label="Clear search"
|
||||||
onClick={() => onChange("")}
|
onClick={() => onChange("")}
|
||||||
// Big style hacks here!
|
// Big style hacks here!
|
||||||
|
|
|
@ -7,10 +7,10 @@ import {
|
||||||
EditableInput,
|
EditableInput,
|
||||||
Flex,
|
Flex,
|
||||||
IconButton,
|
IconButton,
|
||||||
PseudoBox,
|
|
||||||
Skeleton,
|
Skeleton,
|
||||||
VisuallyHidden,
|
VisuallyHidden,
|
||||||
} from "@chakra-ui/core";
|
} from "@chakra-ui/core";
|
||||||
|
import { EditIcon } from "@chakra-ui/icons";
|
||||||
import { CSSTransition, TransitionGroup } from "react-transition-group";
|
import { CSSTransition, TransitionGroup } from "react-transition-group";
|
||||||
|
|
||||||
import { Delay, Heading1, Heading2 } from "./util";
|
import { Delay, Heading1, Heading2 } from "./util";
|
||||||
|
@ -178,7 +178,7 @@ function ItemZoneGroupSkeleton({ itemCount }) {
|
||||||
function OutfitHeading({ outfitState, dispatchToOutfit }) {
|
function OutfitHeading({ outfitState, dispatchToOutfit }) {
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<PseudoBox role="group" d="inline-block" position="relative" width="100%">
|
<Box role="group" d="inline-block" position="relative" width="100%">
|
||||||
<Heading1 mb="6">
|
<Heading1 mb="6">
|
||||||
<Editable
|
<Editable
|
||||||
value={outfitState.name}
|
value={outfitState.name}
|
||||||
|
@ -187,31 +187,31 @@ function OutfitHeading({ outfitState, dispatchToOutfit }) {
|
||||||
dispatchToOutfit({ type: "rename", outfitName: value })
|
dispatchToOutfit({ type: "rename", outfitName: value })
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{({ isEditing, onRequestEdit }) => (
|
{({ isEditing, onEdit }) => (
|
||||||
<Flex align="flex-top">
|
<Flex align="flex-top">
|
||||||
<EditablePreview />
|
<EditablePreview />
|
||||||
<EditableInput />
|
<EditableInput />
|
||||||
{!isEditing && (
|
{!isEditing && (
|
||||||
<PseudoBox
|
<Box
|
||||||
opacity="0"
|
opacity="0"
|
||||||
transition="opacity 0.5s"
|
transition="opacity 0.5s"
|
||||||
_groupHover={{ opacity: "1" }}
|
_groupHover={{ opacity: "1" }}
|
||||||
onClick={onRequestEdit}
|
onClick={onEdit}
|
||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon="edit"
|
icon={<EditIcon />}
|
||||||
variant="link"
|
variant="link"
|
||||||
color="green.600"
|
color="green.600"
|
||||||
aria-label="Edit outfit name"
|
aria-label="Edit outfit name"
|
||||||
title="Edit outfit name"
|
title="Edit outfit name"
|
||||||
/>
|
/>
|
||||||
</PseudoBox>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
</Editable>
|
</Editable>
|
||||||
</Heading1>
|
</Heading1>
|
||||||
</PseudoBox>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,17 @@ import {
|
||||||
Box,
|
Box,
|
||||||
Flex,
|
Flex,
|
||||||
IconButton,
|
IconButton,
|
||||||
PseudoBox,
|
|
||||||
Stack,
|
Stack,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
useClipboard,
|
useClipboard,
|
||||||
useToast,
|
useToast,
|
||||||
} from "@chakra-ui/core";
|
} from "@chakra-ui/core";
|
||||||
|
import {
|
||||||
|
ArrowBackIcon,
|
||||||
|
CheckIcon,
|
||||||
|
DownloadIcon,
|
||||||
|
LinkIcon,
|
||||||
|
} from "@chakra-ui/icons";
|
||||||
|
|
||||||
import PosePicker from "./PosePicker";
|
import PosePicker from "./PosePicker";
|
||||||
import SpeciesColorPicker from "./SpeciesColorPicker";
|
import SpeciesColorPicker from "./SpeciesColorPicker";
|
||||||
|
@ -25,7 +30,7 @@ function OutfitControls({ outfitState, dispatchToOutfit }) {
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PseudoBox
|
<Box
|
||||||
role="group"
|
role="group"
|
||||||
pos="absolute"
|
pos="absolute"
|
||||||
left="0"
|
left="0"
|
||||||
|
@ -58,7 +63,7 @@ function OutfitControls({ outfitState, dispatchToOutfit }) {
|
||||||
<ControlButton
|
<ControlButton
|
||||||
as={Link}
|
as={Link}
|
||||||
to="/"
|
to="/"
|
||||||
icon="arrow-back"
|
icon={<ArrowBackIcon />}
|
||||||
aria-label="Leave this outfit"
|
aria-label="Leave this outfit"
|
||||||
d="inline-flex" // Not sure why <a> requires this to style right! ^^`
|
d="inline-flex" // Not sure why <a> requires this to style right! ^^`
|
||||||
/>
|
/>
|
||||||
|
@ -115,7 +120,7 @@ function OutfitControls({ outfitState, dispatchToOutfit }) {
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
</PseudoBox>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +138,7 @@ function DownloadButton({ outfitState }) {
|
||||||
<Tooltip label="Download" placement="left">
|
<Tooltip label="Download" placement="left">
|
||||||
<Box>
|
<Box>
|
||||||
<ControlButton
|
<ControlButton
|
||||||
icon="download"
|
icon={<DownloadIcon />}
|
||||||
aria-label="Download"
|
aria-label="Download"
|
||||||
as="a"
|
as="a"
|
||||||
// eslint-disable-next-line no-script-url
|
// eslint-disable-next-line no-script-url
|
||||||
|
@ -163,7 +168,7 @@ function CopyLinkButton({ outfitState }) {
|
||||||
<Tooltip label={hasCopied ? "Copied!" : "Copy link"} placement="left">
|
<Tooltip label={hasCopied ? "Copied!" : "Copy link"} placement="left">
|
||||||
<Box>
|
<Box>
|
||||||
<ControlButton
|
<ControlButton
|
||||||
icon={hasCopied ? "check" : "link"}
|
icon={hasCopied ? <CheckIcon /> : <LinkIcon />}
|
||||||
aria-label="Copy link"
|
aria-label="Copy link"
|
||||||
onClick={onCopy}
|
onClick={onCopy}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -2,7 +2,8 @@ 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, Icon, Spinner, Text } from "@chakra-ui/core";
|
import { Box, Flex, Spinner, Text } from "@chakra-ui/core";
|
||||||
|
import { WarningIcon } from "@chakra-ui/icons";
|
||||||
|
|
||||||
import useOutfitAppearance from "./useOutfitAppearance";
|
import useOutfitAppearance from "./useOutfitAppearance";
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ function OutfitPreview({ outfitState }) {
|
||||||
return (
|
return (
|
||||||
<FullScreenCenter>
|
<FullScreenCenter>
|
||||||
<Text color="gray.50" d="flex" alignItems="center">
|
<Text color="gray.50" d="flex" alignItems="center">
|
||||||
<Icon name="warning" />
|
<WarningIcon />
|
||||||
<Box width={2} />
|
<Box width={2} />
|
||||||
Could not load preview. Try again?
|
Could not load preview. Try again?
|
||||||
</Text>
|
</Text>
|
||||||
|
|
|
@ -255,7 +255,7 @@ function PoseOption({ poseInfo, onChange, inputRef }) {
|
||||||
/>
|
/>
|
||||||
<Box
|
<Box
|
||||||
aria-hidden
|
aria-hidden
|
||||||
rounded="full"
|
borderRadius="full"
|
||||||
boxShadow="md"
|
boxShadow="md"
|
||||||
overflow="hidden"
|
overflow="hidden"
|
||||||
width="50px"
|
width="50px"
|
||||||
|
@ -281,7 +281,7 @@ function PoseOption({ poseInfo, onChange, inputRef }) {
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
rounded="full"
|
borderRadius="full"
|
||||||
position="absolute"
|
position="absolute"
|
||||||
top="0"
|
top="0"
|
||||||
bottom="0"
|
bottom="0"
|
||||||
|
|
Loading…
Reference in a new issue