Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update spinners to match the style guide #933

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export default function ConnectWalletButton({
!isLoading ? (
<Icon as={IconArrowNarrowRight} boxSize={6} ml="auto" />
) : (
<Spinner boxSize={6} variant="filled" />
<Spinner />
)
}
iconSpacing={4}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const statusToLabelProps: Record<Status, { color: string }> = {
const boxSize = 5
const statusToIcon: Record<Status, React.ReactNode> = {
idle: <Box boxSize={boxSize} />,
pending: <Spinner boxSize={boxSize} />,
pending: <Spinner boxSize={boxSize} variant="unicolor" />,
error: <Icon as={IconCircleX} boxSize={boxSize} color="text.tertiary" />,
success: <Icon as={IconCircleCheck} boxSize={boxSize} color="green.50" />,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function BuildTransactionModal({
<ModalCloseButton onClick={onClose} />
<ModalHeader>Preparing withdrawal transaction...</ModalHeader>
<ModalBody>
<Spinner size="xl" variant="filled" />
<Spinner size="lg" />
<Text size="md">This may take a few minutes.</Text>
<Button size="lg" width="100%" variant="outline" onClick={onClose}>
Cancel
Expand Down
2 changes: 1 addition & 1 deletion dapp/src/components/TransactionModal/ResumeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function ResumeModal({ closeModal }: BaseModalProps) {
</ModalHeader>
<ModalBody textAlign="start" py={6} mx={3} gap={4}>
<HStack position="relative" justifyContent="center">
<Spinner size="2xl" variant="filled" />
<Spinner size="xl" />
<PauseIcon position="absolute" boxSize={6} color="acre.50" />
</HStack>

Expand Down
5 changes: 3 additions & 2 deletions dapp/src/components/shared/LoadingButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react"
import { Button, ButtonProps, Spinner } from "@chakra-ui/react"
import { Button, ButtonProps } from "@chakra-ui/react"
import Spinner from "./Spinner"

export default function LoadingButton({
isLoading,
Expand All @@ -9,7 +10,7 @@ export default function LoadingButton({
return (
<Button
isLoading={isLoading}
spinner={<Spinner variant="filled" />}
spinner={<Spinner variant="unicolor" size="sm" />}
{...props}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function CalculationInProgressLabel() {
</Text>
)}
<HStack spacing={0}>
<Spinner mr={3} size="sm" />
<Spinner mr={3} variant="unicolor" />
<Text size="md">Your drop is being prepared.</Text>
<TooltipIcon
label={`
Expand Down
50 changes: 35 additions & 15 deletions dapp/src/theme/spinnerTheme.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,59 @@
import { defineStyle, defineStyleConfig } from "@chakra-ui/react"

const baseStyle = defineStyle({
const variantBicolor = defineStyle({
color: "acre.50",
borderWidth: 2,
borderBottomColor: "acre.50",
})

const variantFilled = defineStyle({
borderWidth: 3,
borderTopColor: "brown.20",
borderBottomColor: "brown.20",
borderLeftColor: "brown.20",
})

const variantUnicolor = defineStyle({
color: "acre.50",
borderBottomColor: "acre.50",
})

const variants = {
filled: variantFilled,
bicolor: variantBicolor,
unicolor: variantUnicolor,
}

// TODO: Confirm with the design
const sizeXl = defineStyle({
width: 16,
height: 16,
})

const size2Xl = defineStyle({
borderWidth: 3,
width: 20,
height: 20,
})

const sizeLg = defineStyle({
borderWidth: 3,
width: 14,
height: 14,
})

const sizeMd = defineStyle({
borderWidth: 2,
width: 6,
height: 6,
})

// TODO: Confirm with the design
const sizeSm = defineStyle({
borderWidth: 2,
width: 4,
height: 4,
})

const sizes = {
xl: sizeXl,
"2xl": size2Xl,
lg: sizeLg,
md: sizeMd,
sm: sizeSm,
}

export default defineStyleConfig({
baseStyle,
defaultProps: {
variant: "bicolor",
},
sizes,
variants,
})
Loading