Added Label comp and minor style fixes

This commit is contained in:
muzam1l
2022-04-08 14:41:08 +05:30
parent c219f7ea00
commit 2287e7babb
11 changed files with 38 additions and 44 deletions

View File

@@ -18,7 +18,7 @@ import {
DialogTrigger, DialogTrigger,
} from "./Dialog"; } from "./Dialog";
import { css } from "../stitches.config"; import { css } from "../stitches.config";
import { Input } from "./Input"; import { Input, Label } from "./Input";
import truncate from "../utils/truncate"; import truncate from "../utils/truncate";
const labelStyle = css({ const labelStyle = css({
@@ -491,7 +491,7 @@ const ImportAccountDialog = () => {
<DialogContent> <DialogContent>
<DialogTitle>Import account</DialogTitle> <DialogTitle>Import account</DialogTitle>
<DialogDescription> <DialogDescription>
<label>Add account secret</label> <Label>Add account secret</Label>
<Input <Input
name="secret" name="secret"
type="password" type="password"

View File

@@ -47,7 +47,7 @@ import {
} from "./Dialog"; } from "./Dialog";
import Flex from "./Flex"; import Flex from "./Flex";
import Stack from "./Stack"; import Stack from "./Stack";
import Input from "./Input"; import { Input, Label } from "./Input";
import Text from "./Text"; import Text from "./Text";
import Tooltip from "./Tooltip"; import Tooltip from "./Tooltip";
import { import {
@@ -222,7 +222,7 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => {
<DialogContent> <DialogContent>
<DialogTitle>Create new file</DialogTitle> <DialogTitle>Create new file</DialogTitle>
<DialogDescription> <DialogDescription>
<label>Filename</label> <Label>Filename</Label>
<Input <Input
value={filename} value={filename}
onChange={(e) => setFilename(e.target.value)} onChange={(e) => setFilename(e.target.value)}
@@ -524,7 +524,7 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => {
<DialogContent> <DialogContent>
<DialogTitle>Editor settings</DialogTitle> <DialogTitle>Editor settings</DialogTitle>
<DialogDescription> <DialogDescription>
<label>Tab size</label> <Label>Tab size</Label>
<Input <Input
type="number" type="number"
min="1" min="1"

View File

@@ -1,5 +1,6 @@
import React from "react"; import React from "react";
import { styled } from "../stitches.config"; import { styled } from "../stitches.config";
import * as LabelPrim from '@radix-ui/react-label';
export const Input = styled("input", { export const Input = styled("input", {
// Reset // Reset
@@ -156,3 +157,11 @@ const ReffedInput = React.forwardRef<
>((props, ref) => <Input {...props} ref={ref} />); >((props, ref) => <Input {...props} ref={ref} />);
export default ReffedInput; export default ReffedInput;
const LabelRoot = (props: LabelPrim.LabelProps) => <LabelPrim.Root {...props} />
export const Label = styled(LabelRoot, {
display: 'inline-block',
mb: '$1'
})

View File

@@ -52,6 +52,7 @@ const Select = forwardRef<any, Props>((props, ref) => {
control: (provided, state) => { control: (provided, state) => {
return { return {
...provided, ...provided,
minHeight: 0,
border: "0px", border: "0px",
backgroundColor: colors.mauve4, backgroundColor: colors.mauve4,
boxShadow: `0 0 0 1px ${ boxShadow: `0 0 0 1px ${
@@ -118,32 +119,6 @@ const Select = forwardRef<any, Props>((props, ref) => {
}; };
}, },
}} }}
// theme={(theme) => ({
// ...theme,
// spacing: {
// ...theme.spacing,
// controlHeight: 30,
// },
// colors: {
// primary: colors.selected,
// primary25: colors.active,
// primary50: colors.primary,
// primary75: colors.primary,
// danger: colors.primary,
// dangerLight: colors.primary,
// neutral0: colors.background,
// neutral5: colors.primary,
// neutral10: colors.primary,
// neutral20: colors.outline,
// neutral30: colors.primary,
// neutral40: colors.primary,
// neutral50: colors.placeholder,
// neutral60: colors.primary,
// neutral70: colors.primary,
// neutral80: colors.searchText,
// neutral90: colors.primary,
// },
// })}
{...props} {...props}
/> />
); );

View File

@@ -11,7 +11,7 @@ import {
DialogClose, DialogClose,
DialogTrigger, DialogTrigger,
} from "./Dialog"; } from "./Dialog";
import { Input } from "./Input"; import { Input, Label } from "./Input";
import { import {
Controller, Controller,
SubmitHandler, SubmitHandler,
@@ -111,7 +111,7 @@ export const SetHookDialog: React.FC<{ account: IAccount }> = ({ account }) => {
<DialogDescription as="div"> <DialogDescription as="div">
<Stack css={{ width: "100%", flex: 1 }}> <Stack css={{ width: "100%", flex: 1 }}>
<Box css={{ width: "100%" }}> <Box css={{ width: "100%" }}>
<label>Invoke on transactions</label> <Label>Invoke on transactions</Label>
<Controller <Controller
name="Invoke" name="Invoke"
control={control} control={control}
@@ -130,9 +130,9 @@ export const SetHookDialog: React.FC<{ account: IAccount }> = ({ account }) => {
/> />
</Box> </Box>
<Box css={{ width: "100%" }}> <Box css={{ width: "100%" }}>
<label style={{ marginBottom: "10px", display: "block" }}> <Label css={{mb: '$2'}}>
Hook parameters Hook parameters
</label> </Label>
<Stack> <Stack>
{fields.map((field, index) => ( {fields.map((field, index) => (
<Stack key={field.id}> <Stack key={field.id}>

View File

@@ -6,7 +6,7 @@ import React, {
useCallback, useCallback,
} from "react"; } from "react";
import type { ReactNode, ReactElement } from "react"; import type { ReactNode, ReactElement } from "react";
import { Box, Button, Flex, Input, Stack, Text } from "."; import { Box, Button, Flex, Input, Label, Stack, Text } from ".";
import { import {
Dialog, Dialog,
DialogTrigger, DialogTrigger,
@@ -128,7 +128,7 @@ export const Tabs = ({
gap: "$3", gap: "$3",
flex: 1, flex: 1,
flexWrap: "nowrap", flexWrap: "nowrap",
marginBottom: "-1px", marginBottom: "$2",
width: "100%", width: "100%",
overflow: "auto", overflow: "auto",
}} }}
@@ -192,7 +192,7 @@ export const Tabs = ({
<DialogContent> <DialogContent>
<DialogTitle>Create new tab</DialogTitle> <DialogTitle>Create new tab</DialogTitle>
<DialogDescription> <DialogDescription>
<label>Tabname</label> <Label>Tabname</Label>
<Input <Input
value={tabname} value={tabname}
onChange={(e) => setTabname(e.target.value)} onChange={(e) => setTabname(e.target.value)}

View File

@@ -54,7 +54,6 @@ const Transaction: FC<TransactionProps> = ({
...props ...props
}) => { }) => {
const { accounts } = useSnapshot(state); const { accounts } = useSnapshot(state);
console.log("Transaction");
const transactionsOptions = transactionsData.map(tx => ({ const transactionsOptions = transactionsData.map(tx => ({
value: tx.TransactionType, value: tx.TransactionType,
@@ -92,7 +91,7 @@ const Transaction: FC<TransactionProps> = ({
if (!_txFields) return setState({ txFields: {} }); if (!_txFields) return setState({ txFields: {} });
_txFields = { ..._txFields } as TxFields; _txFields = { ..._txFields } as TxFields;
if (!_txFields.Destination) setState({ selectedDestAccount: null }) if (!_txFields.Destination) setState({ selectedDestAccount: null });
// @ts-ignore // @ts-ignore
delete _txFields.TransactionType; delete _txFields.TransactionType;
// @ts-ignore // @ts-ignore
@@ -266,7 +265,7 @@ const Transaction: FC<TransactionProps> = ({
}, },
}) })
} }
css={{ width: "70%", flex: "inherit", height: "$9" }} css={{ width: "70%", flex: "inherit" }}
/> />
</Flex> </Flex>
)} )}
@@ -332,7 +331,7 @@ const Transaction: FC<TransactionProps> = ({
}, },
}) })
} }
css={{ width: "70%", flex: "inherit", height: "$9" }} css={{ width: "70%", flex: "inherit" }}
/> />
</Flex> </Flex>
); );

View File

@@ -4,7 +4,7 @@ export { default as Container } from "./Container";
export { default as Heading } from "./Heading"; export { default as Heading } from "./Heading";
export { default as Stack } from "./Stack"; export { default as Stack } from "./Stack";
export { default as Text } from "./Text"; export { default as Text } from "./Text";
export { default as Input } from "./Input"; export { default as Input, Label } from "./Input";
export { default as Select } from "./Select"; export { default as Select } from "./Select";
export * from "./Tabs"; export * from "./Tabs";
export * from "./AlertDialog"; export * from "./AlertDialog";

View File

@@ -19,6 +19,7 @@
"@radix-ui/react-dialog": "^0.1.1", "@radix-ui/react-dialog": "^0.1.1",
"@radix-ui/react-dropdown-menu": "^0.1.1", "@radix-ui/react-dropdown-menu": "^0.1.1",
"@radix-ui/react-id": "^0.1.1", "@radix-ui/react-id": "^0.1.1",
"@radix-ui/react-label": "^0.1.5",
"@radix-ui/react-tooltip": "^0.1.7", "@radix-ui/react-tooltip": "^0.1.7",
"@stitches/react": "^1.2.6-0", "@stitches/react": "^1.2.6-0",
"base64-js": "^1.5.1", "base64-js": "^1.5.1",

View File

@@ -76,7 +76,6 @@ const modifyTransaction = (
const Test = () => { const Test = () => {
const { transactionLogs } = useSnapshot(state); const { transactionLogs } = useSnapshot(state);
const { transactions } = useSnapshot(testState); const { transactions } = useSnapshot(testState);
console.log("Test");
return ( return (
<Container css={{ px: 0 }}> <Container css={{ px: 0 }}>
<Split <Split

View File

@@ -674,6 +674,17 @@
"@babel/runtime" "^7.13.10" "@babel/runtime" "^7.13.10"
"@radix-ui/react-use-layout-effect" "0.1.0" "@radix-ui/react-use-layout-effect" "0.1.0"
"@radix-ui/react-label@^0.1.5":
version "0.1.5"
resolved "https://registry.yarnpkg.com/@radix-ui/react-label/-/react-label-0.1.5.tgz#12cd965bfc983e0148121d4c99fb8e27a917c45c"
integrity sha512-Au9+n4/DhvjR0IHhvZ1LPdx/OW+3CGDie30ZyCkbSHIuLp4/CV4oPPGBwJ1vY99Jog3zyQhsGww9MXj8O9Aj/A==
dependencies:
"@babel/runtime" "^7.13.10"
"@radix-ui/react-compose-refs" "0.1.0"
"@radix-ui/react-context" "0.1.1"
"@radix-ui/react-id" "0.1.5"
"@radix-ui/react-primitive" "0.1.4"
"@radix-ui/react-menu@0.1.6": "@radix-ui/react-menu@0.1.6":
version "0.1.6" version "0.1.6"
resolved "https://registry.yarnpkg.com/@radix-ui/react-menu/-/react-menu-0.1.6.tgz#7f9521a10f6a9cd819b33b33d5ed9538d79b2e75" resolved "https://registry.yarnpkg.com/@radix-ui/react-menu/-/react-menu-0.1.6.tgz#7f9521a10f6a9cd819b33b33d5ed9538d79b2e75"