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

Refine styling #311

Merged
merged 17 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from 13 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Improvements

- [#311](https://github.com/alleslabs/celatone-frontend/pull/311) Refine css styling
jennieramida marked this conversation as resolved.
Show resolved Hide resolved
- [#298](https://github.com/alleslabs/celatone-frontend/pull/298) Show deposit/voting period from gov params and add minimum required alert

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion src/lib/app-fns/tx/common/sending.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const sendingTx = (fee: StdFee) => {
],
receiptInfo: {
header: "Sending Transaction",
headerIcon: <Spinner size="md" color="pebble.600" />,
headerIcon: <Spinner size="md" />,
},
actionVariant: "sending",
} as TxResultRendering;
Expand Down
4 changes: 3 additions & 1 deletion src/lib/app-fns/tx/upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ export const uploadContractTx = ({
{isMigrate ? "migrate" : "instantiate"} your code now?
</>
),
headerIcon: <CustomIcon name="upload-cloud" boxSize="5" />,
headerIcon: (
<CustomIcon name="upload-cloud" boxSize="5" color="pebble.600" />
),
},
actionVariant: isMigrate ? "upload-migrate" : "upload",
} as TxResultRendering;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/ButtonCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ export const ButtonCard = ({
description
)}
</Stack>
<CustomIcon name="chevron-right" />
<CustomIcon name="chevron-right" color="pebble.600" />
</Flex>
);
6 changes: 2 additions & 4 deletions src/lib/components/ConnectWalletAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
Flex,
Box,
Button,
Text,
} from "@chakra-ui/react";
import type { AlertProps } from "@chakra-ui/react";
import { useWallet } from "@cosmos-kit/react";
Expand Down Expand Up @@ -42,15 +41,14 @@ export const ConnectWalletAlert = ({
py="12px"
>
<Flex gap={2}>
<CustomIcon name="wallet-solid" color="honeydew.main" boxSize="4" />
<CustomIcon name="wallet-solid" boxSize="4" />
<Box>
<AlertTitle>{title}</AlertTitle>
<AlertDescription>{subtitle}</AlertDescription>
</Box>
</Flex>
<Button size="sm" variant="ghost-info" gap={2} onClick={onClickConnect}>
<CustomIcon name="connect" color="honeydew.main" />
<Text color="honeydew.main">Connect Wallet</Text>
<CustomIcon name="connect" /> Connect Wallet
</Button>
</Alert>
) : null;
Expand Down
6 changes: 2 additions & 4 deletions src/lib/components/ContractSelectSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const ContractDetailsButton = ({
variant="ghost-gray"
float="right"
size="sm"
leftIcon={<CustomIcon name="edit" color="text.dark" />}
leftIcon={<CustomIcon name="edit" />}
>
Edit
</Button>
Expand All @@ -120,9 +120,7 @@ const ContractDetailsButton = ({
variant="outline-gray"
float="right"
size="sm"
leftIcon={
<CustomIcon name="bookmark" color="text.dark" boxSize="12px" />
}
leftIcon={<CustomIcon name="bookmark" boxSize="12px" />}
>
Add To List
</Button>
Expand Down
15 changes: 9 additions & 6 deletions src/lib/components/CopyLink.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Flex, Text, Tooltip, useClipboard } from "@chakra-ui/react";
import { Flex, Text, useClipboard } from "@chakra-ui/react";
import { useWallet } from "@cosmos-kit/react";
import { useState } from "react";

import { AmpTrackCopier } from "lib/services/amplitude";

import { CustomIcon } from "./icon";
import { Tooltip } from "./TooltipComponent";

interface CopyLinkProps {
value: string;
Expand All @@ -18,12 +19,8 @@ export const CopyLink = ({ value, amptrackSection, type }: CopyLinkProps) => {
const [isHover, setIsHover] = useState(false);
return (
<Tooltip
hasArrow
isOpen={isHover || hasCopied}
label={hasCopied ? "Copied!" : "Click to copy"}
placement="top"
arrowSize={8}
bgColor="honeydew.darker"
closeOnClick={false}
>
<Flex
Expand All @@ -48,7 +45,13 @@ export const CopyLink = ({ value, amptrackSection, type }: CopyLinkProps) => {
>
{value === address ? `${value} (Me)` : value}
</Text>
<CustomIcon cursor="pointer" marginLeft={2} name="copy" boxSize={3} />
<CustomIcon
cursor="pointer"
marginLeft={2}
name="copy"
boxSize={3}
color="pebble.600"
/>
</Flex>
</Tooltip>
);
Expand Down
7 changes: 1 addition & 6 deletions src/lib/components/CustomTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const CustomTab = ({ count, ...restProps }: CustomTabProps) => {
lineHeight="24px"
letterSpacing="0.4px"
variant="ghost-gray"
color="text.dark"
mb={0}
sx={{
"&[aria-selected=true]": {
Expand All @@ -35,11 +34,7 @@ export const CustomTab = ({ count, ...restProps }: CustomTabProps) => {
{tabProps.children}

{count !== undefined && (
<Badge
variant={isSelected ? "violet" : "gray"}
ml="6px"
color="text.main"
>
<Badge variant={isSelected ? "violet" : "gray"} ml="6px">
{count}
</Badge>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/EstimatedFeeRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const EstimatedFeeRender = ({
if (loading) {
return (
<>
<Spinner color="pebble.600" size="sm" mx={1} /> Estimating ...
<Spinner size="sm" mx={1} /> Estimating ...
</>
);
}
Expand Down
11 changes: 3 additions & 8 deletions src/lib/components/Expedited.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Flex, Tooltip, Text, Highlight } from "@chakra-ui/react";
import { Flex, Text, Highlight } from "@chakra-ui/react";

import { CustomIcon } from "./icon";
import { Tooltip } from "./TooltipComponent";

const ExpeditedText = (
<Text variant="body3">
Expand All @@ -18,13 +19,7 @@ interface ExpeditedProps {
isActiveExpedited: boolean;
}
export const Expedited = ({ isActiveExpedited }: ExpeditedProps) => (
<Tooltip
hasArrow
label={ExpeditedText}
placement="top"
bg="honeydew.darker"
arrowSize={8}
>
<Tooltip label={ExpeditedText}>
<Flex align="center">
<CustomIcon
name="expedited"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/InputWithIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const InputWithIcon = ({
size={size}
/>
<InputRightElement h="56px" alignItems="center" mr="1">
<CustomIcon name="search" />
<CustomIcon name="search" color="pebble.600" />
</InputRightElement>
</InputGroup>
);
Expand Down
12 changes: 3 additions & 9 deletions src/lib/components/ListSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,12 @@ export const ListSelection = forwardRef<HTMLInputElement, ListSelectionProps>(
<Tag
cursor="pointer"
whiteSpace="nowrap"
size="md"
bgColor="violet.light"
color="pebble.900"
alignItems="center"
display="flex"
textTransform="none"
variant="violet-light"
gap={1}
mr={2}
borderRadius="full"
mr={1}
>
{option.label}
<CustomIcon name="close" color="pebble.900" boxSize="3" />
<CustomIcon name="close" boxSize="3" />
</Tag>
</Flex>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Loading = () => (
flexDirection="column"
alignItems="center"
>
<Spinner size="xl" speed="0.65s" />
<Spinner size="xl" />
<Text mt="20px">Loading ...</Text>
</Flex>
);
2 changes: 1 addition & 1 deletion src/lib/components/LoadingOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const LoadingOverlay = () => (
left={0}
zIndex="overlay"
>
<Spinner color="pebble.600" size="xl" />
<Spinner size="xl" />
<Text variant="body1">Loading ...</Text>
</Flex>
);
25 changes: 8 additions & 17 deletions src/lib/components/PermissionChip.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { chakra, Tag, Tooltip } from "@chakra-ui/react";
import { Flex, Tag } from "@chakra-ui/react";
import { useWallet } from "@cosmos-kit/react";
import type { CSSProperties } from "react";

import type { HumanAddr, PermissionAddresses } from "lib/types";
import { AccessConfigPermission } from "lib/types";
import { getPermissionHelper } from "lib/utils";

const StyledTag = chakra(Tag, {
baseStyle: {
borderRadius: "16px",
fontSize: "12px",
fontWeight: 400,
color: "text.main",
w: "fit-content",
},
});
import { Tooltip } from "./TooltipComponent";

interface PermissionChipProps {
instantiatePermission: AccessConfigPermission;
Expand All @@ -31,19 +22,19 @@ export const PermissionChip = ({
permissionAddresses.includes(address as HumanAddr) ||
instantiatePermission === AccessConfigPermission.EVERYBODY;

const tagBgColor: CSSProperties["backgroundColor"] = isAllowed
? "honeydew.darker"
: "pebble.700";

const { message } = getPermissionHelper(
address as HumanAddr,
instantiatePermission,
permissionAddresses
);

return (
<Tooltip hasArrow label={message} placement="top" bg="honeydew.darker">
<StyledTag bgColor={tagBgColor}>{instantiatePermission}</StyledTag>
<Tooltip label={message}>
<Flex>
<Tag size="md" variant={isAllowed ? "honeydew-darker" : "gray"}>
{instantiatePermission}
</Tag>
</Flex>
</Tooltip>
);
};
35 changes: 4 additions & 31 deletions src/lib/components/TagSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ const listItemProps: CSSProperties = {
padding: "8px",
cursor: "pointer",
};
const tagItemProps: CSSProperties = {
borderRadius: "24px",
cursor: "pointer",
whiteSpace: "nowrap",
alignItems: "center",
display: "flex",
textTransform: "none",
gap: "4px",
marginRight: "8px",
};

export const TagSelection = observer(
forwardRef<HTMLInputElement, TagSelectionProps>(
Expand All @@ -59,7 +49,6 @@ export const TagSelection = observer(
result,
setResult,
placeholder,
badgeBgColor = "honeydew.darker",
helperText,
labelBgColor = "background.main",
label = "Tags",
Expand Down Expand Up @@ -163,17 +152,9 @@ export const TagSelection = observer(
onClick={() => selectOption(option)}
key={option}
>
<Tag
style={tagItemProps}
size="md"
bgColor={badgeBgColor}
>
<Tag gap={1} mr={1} cursor="pointer">
{option}
<CustomIcon
name="close"
color="text.dark"
boxSize="3"
/>
<CustomIcon name="close" boxSize="3" />
</Tag>
</Flex>
))}
Expand Down Expand Up @@ -257,11 +238,7 @@ export const TagSelection = observer(
onClick={() => selectOptionFromList(option)}
>
<Flex alignItems="center" justifyContent="space-between">
<Tag
style={tagItemProps}
size="sm"
bgColor={badgeBgColor}
>
<Tag gap={1} mr={1}>
{option}
</Tag>
{isOptionSelected(option) && (
Expand All @@ -287,11 +264,7 @@ export const TagSelection = observer(
>
<Flex alignItems="center" gap={2}>
<Text variant="body2">Create </Text>
<Tag
style={tagItemProps}
size="sm"
bgColor={badgeBgColor}
>
<Tag gap={1} mr={1}>
{inputValue}
</Tag>
</Flex>
Expand Down
6 changes: 2 additions & 4 deletions src/lib/components/TokenCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FlexProps } from "@chakra-ui/react";
import { Badge, Flex, Image, Text, Tooltip } from "@chakra-ui/react";
import { Badge, Flex, Image, Text } from "@chakra-ui/react";

import { NAToken } from "lib/icon";
import type { BalanceWithAssetInfo, Token, U, USD } from "lib/types";
Expand All @@ -10,6 +10,7 @@ import {
} from "lib/utils";

import { Copier } from "./copy";
import { Tooltip } from "./TooltipComponent";

interface TokenCardProps extends FlexProps {
userBalance: BalanceWithAssetInfo;
Expand All @@ -25,10 +26,7 @@ export const TokenCard = ({

return (
<Tooltip
hasArrow
label={`Token ID: ${id}`}
placement="top"
bg="honeydew.darker"
maxW="240px"
whiteSpace="pre-line"
textAlign="center"
Expand Down
11 changes: 5 additions & 6 deletions src/lib/components/TooltipComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import type { TooltipProps } from "@chakra-ui/react";
import { Tooltip } from "@chakra-ui/react";
import { Tooltip as ChakraTooltip } from "@chakra-ui/react";

export const TooltipComponent = ({
placement,
export const Tooltip = ({
placement = "top",
...tooltipProps
}: TooltipProps) => (
<Tooltip
<ChakraTooltip
hasArrow
placement={placement ?? "top"}
bg="honeydew.darker"
placement={placement}
arrowSize={8}
{...tooltipProps}
/>
Expand Down
Loading
Loading