From 3bc02538cf1f7283abff8909d48c941e989488ab Mon Sep 17 00:00:00 2001 From: fran-ink <171171801+fran-ink@users.noreply.github.com> Date: Mon, 16 Dec 2024 09:51:03 -0500 Subject: [PATCH 1/2] feat: input icons --- package.json | 2 +- src/components/Input/Input.stories.tsx | 13 +++++++++++++ src/components/Input/Input.tsx | 26 +++++++++++++++++++------- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 5695195..0e93327 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@inkonchain/ink-kit", - "version": "0.3.0", + "version": "0.3.2", "description": "", "main": "dist/index.cjs.js", "module": "dist/index.es.js", diff --git a/src/components/Input/Input.stories.tsx b/src/components/Input/Input.stories.tsx index 7a52eff..cc4e5f8 100644 --- a/src/components/Input/Input.stories.tsx +++ b/src/components/Input/Input.stories.tsx @@ -1,5 +1,6 @@ import type { Meta, StoryObj } from "@storybook/react"; import { Input, type InputProps } from "./index"; +import { InkIcon } from "../.."; const meta: Meta = { title: "Components/Input", @@ -17,3 +18,15 @@ type Story = StoryObj; export const Simple: Story = { args: {}, }; + +export const WithIconLeft: Story = { + args: { + iconLeft: , + }, +}; + +export const WithIconRight: Story = { + args: { + iconRight: , + }, +}; diff --git a/src/components/Input/Input.tsx b/src/components/Input/Input.tsx index 9212424..d0927de 100644 --- a/src/components/Input/Input.tsx +++ b/src/components/Input/Input.tsx @@ -4,20 +4,32 @@ import { classNames } from "../../util/classes"; export interface InputProps extends React.InputHTMLAttributes { className?: string; + iconLeft?: React.ReactNode; + iconRight?: React.ReactNode; } export const Input = forwardRef( - ({ className, ...props }, ref) => { + ({ className, iconLeft, iconRight, ...props }, ref) => { + const iconClasses = + "ink:shrink-0 ink:size-3 ink:-my-1 ink:flex ink:items-center ink:justify-center ink:group-focus-within:text-text-on-secondary ink:transition-colors ink:transition-default-animation"; return ( - + > + {iconLeft &&
{iconLeft}
} + + {iconRight &&
{iconRight}
} + ); } ); From 0280b25f929787e5c5e2305bc90ffb418a223903 Mon Sep 17 00:00:00 2001 From: fran-ink <171171801+fran-ink@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:16:54 -0500 Subject: [PATCH 2/2] fix: missing color --- src/components/Input/Input.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Input/Input.tsx b/src/components/Input/Input.tsx index d0927de..6c5227d 100644 --- a/src/components/Input/Input.tsx +++ b/src/components/Input/Input.tsx @@ -11,7 +11,7 @@ export interface InputProps export const Input = forwardRef( ({ className, iconLeft, iconRight, ...props }, ref) => { const iconClasses = - "ink:shrink-0 ink:size-3 ink:-my-1 ink:flex ink:items-center ink:justify-center ink:group-focus-within:text-text-on-secondary ink:transition-colors ink:transition-default-animation"; + "ink:shrink-0 ink:size-3 ink:-my-1 ink:flex ink:items-center ink:justify-center ink:text-text-muted ink:group-focus-within:text-text-on-secondary ink:transition-colors ink:transition-default-animation"; return (