Files
explore/ui/address/contract/methods/form/ContractMethodFieldLabel.tsx
tom goriunovandGitHub f6725649da UI toolkit package (#2691)
* first version of the pack

* single entry point

* add custom components to the package

* move form components to toolkit

* add more utils and hooks to the package

* minor fixes

* add CI workflow

* update readme and package.json

* fix ts

* fix build of env-validator

* fix docker build

* fix icons size

* test fixes

* more test fixes
2025-04-21 19:44:22 +02:00

34 lines
864 B
TypeScript

import { Box } from '@chakra-ui/react';
import React from 'react';
import type { ContractAbiItemInput } from '../types';
import { Hint } from 'toolkit/components/Hint/Hint';
import { getFieldLabel } from './utils';
interface Props {
data: ContractAbiItemInput;
isOptional?: boolean;
level: number;
}
const ContractMethodFieldLabel = ({ data, isOptional, level }: Props) => {
return (
<Box
w="250px"
textStyle="sm"
py="6px"
flexShrink={ 0 }
fontWeight={ 500 }
color={ level > 1 ? { _light: 'blackAlpha.600', _dark: 'whiteAlpha.600' } : undefined }
wordBreak="break-all"
>
{ getFieldLabel(data, !isOptional) }
{ data.type === 'string' && <Hint label={ `The "" string will be treated as an empty string` } ml={ 2 }/> }
</Box>
);
};
export default React.memo(ContractMethodFieldLabel);