From 155146b394c5b7392b5db7bc747022dfdc63f5df Mon Sep 17 00:00:00 2001 From: Griko Nibras Date: Wed, 13 Apr 2022 04:33:54 +0700 Subject: [PATCH 1/7] feat(dapp/deps): add clsx dependency --- apps/dapp/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/dapp/package.json b/apps/dapp/package.json index 9b6859840..453ecb6e2 100644 --- a/apps/dapp/package.json +++ b/apps/dapp/package.json @@ -34,6 +34,7 @@ "@types/react-json-editor-ajrm": "^2.5.2", "ajv": "^8.9.0", "axios": "^0.26.1", + "clsx": "^1.1.1", "codemirror": "^5.65.0", "dotenv": "^10.0.0", "fast-average-color-node": "^2.1.0", From 9c6622537511d6260daaf8ae84936894051cf882 Mon Sep 17 00:00:00 2001 From: Griko Nibras Date: Thu, 14 Apr 2022 01:31:16 +0700 Subject: [PATCH 2/7] feat(dapp/ui): create tooltip icon component --- .../components/TooltipsDisplay/TooltipIcon.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 apps/dapp/components/TooltipsDisplay/TooltipIcon.tsx diff --git a/apps/dapp/components/TooltipsDisplay/TooltipIcon.tsx b/apps/dapp/components/TooltipsDisplay/TooltipIcon.tsx new file mode 100644 index 000000000..4cf69cce1 --- /dev/null +++ b/apps/dapp/components/TooltipsDisplay/TooltipIcon.tsx @@ -0,0 +1,16 @@ +import { forwardRef } from 'react' + +import { InformationCircleIcon } from '@heroicons/react/outline' +import Tooltip, { TooltipProps } from '@reach/tooltip' + +export type TooltipIconProps = Omit + +export const TooltipIcon = forwardRef( + function TooltipIcon(props, ref) { + return ( + + + + ) + } +) From 21e6033283decf125ce9a6dc67e51d92ccf45005 Mon Sep 17 00:00:00 2001 From: Griko Nibras Date: Thu, 14 Apr 2022 17:32:45 +0700 Subject: [PATCH 3/7] feat(dapp/ui): improve input label component --- apps/dapp/components/input/InputLabel.tsx | 30 ++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/apps/dapp/components/input/InputLabel.tsx b/apps/dapp/components/input/InputLabel.tsx index 69f172eec..c3b1094c7 100644 --- a/apps/dapp/components/input/InputLabel.tsx +++ b/apps/dapp/components/input/InputLabel.tsx @@ -1,19 +1,31 @@ -export function InputLabel({ - className, - mono, - name, -}: { - className?: string +import { ComponentProps, ReactNode } from 'react' + +import clsx from 'clsx' + +import { TooltipIcon } from '@components/TooltipsDisplay/TooltipIcon' + +export type InputLabelProps = Omit, 'children'> & { mono?: boolean name: string -}) { + tooltip?: ReactNode + _outer?: Omit, 'children'> +} + +export function InputLabel(props: InputLabelProps) { + const { className, mono, name, tooltip, _outer, ...rest } = props + return ( -