Skip to content

Commit 98a28c9

Browse files
authored
Merge pull request #1087 from kadena-community/refactor/input-left-icon-update
Refactor/input left icon update
2 parents 1a028e6 + c9df9c6 commit 98a28c9

File tree

8 files changed

+28
-22
lines changed

8 files changed

+28
-22
lines changed

.changeset/polite-forks-poke.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@kadena/react-ui': minor
3+
'@kadena/docs': minor
4+
---
5+
6+
Updated leftIcon prop to icon

packages/apps/docs/src/components/BottomPageSection/components/Subscribe.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const Subscribe: FC = () => {
2929
<Stack gap="$sm">
3030
<Input
3131
id="email"
32-
leftIcon="At"
32+
icon="At"
3333
onChange={handleFormState}
3434
placeholder="Email address"
3535
outlined

packages/apps/tools/src/components/Global/AccountNameField/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const AccountNameField: FC<IAccountNameFieldProps> = ({
8585
setSelectedAccount(e.target.value);
8686
onChange?.(e);
8787
}}
88-
leftIcon={noIcon ? undefined : 'KIcon'}
88+
icon={noIcon ? undefined : 'KIcon'}
8989
/>
9090
),
9191
};

packages/apps/tools/src/components/Global/RequestKeyField/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const RequestKeyField: FC<IRequestKeyFieldProps> = ({
5050
inputProps={{
5151
id: 'request-key-input',
5252
placeholder: t('Enter Request Key'),
53-
leftIcon: 'KeyIconFilled',
53+
icon: 'KeyIconFilled',
5454
...inputProps,
5555
}}
5656
/>

packages/libs/react-ui/src/components/Input/Input.stories.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const meta: Meta<IInputProps> = {
5959
defaultValue: { summary: 'false' },
6060
},
6161
},
62-
leftIcon: {
62+
icon: {
6363
description:
6464
'Icon rendered inside the input to the left of the input text.',
6565
options: [
@@ -115,24 +115,24 @@ export default meta;
115115
type Story = StoryObj<
116116
{
117117
leadingText: string;
118-
leftIcon: keyof typeof SystemIcon;
118+
icon: keyof typeof SystemIcon;
119119
rightIcon: keyof typeof SystemIcon;
120120
type: React.HTMLInputTypeAttribute;
121-
} & Omit<IInputProps, 'leftIcon' | 'rightIcon'>
121+
} & Omit<IInputProps, 'icon' | 'rightIcon'>
122122
>;
123123

124124
export const Dynamic: Story = {
125125
name: 'Input',
126126
args: {
127-
leftIcon: undefined,
127+
icon: undefined,
128128
type: 'text',
129129
rightIcon: undefined,
130130
leadingText: '',
131131
leadingTextWidth: undefined,
132132
outlined: false,
133133
},
134134
render: ({
135-
leftIcon,
135+
icon,
136136
rightIcon,
137137
outlined,
138138
leadingText,
@@ -143,7 +143,7 @@ export const Dynamic: Story = {
143143
}) => (
144144
<Input
145145
id="inlineInputStory"
146-
leftIcon={leftIcon}
146+
icon={icon}
147147
rightIcon={rightIcon}
148148
onChange={onChange}
149149
placeholder="This is a placeholder"
@@ -159,14 +159,14 @@ export const Dynamic: Story = {
159159
export const InlineWithButton: Story = {
160160
name: 'Inline with button',
161161
args: {
162-
leftIcon: undefined,
162+
icon: undefined,
163163
type: 'text',
164164
},
165-
render: ({ leftIcon, onChange, type }) => (
165+
render: ({ icon, onChange, type }) => (
166166
<Stack gap="$xs" alignItems="stretch">
167167
<Input
168168
id="inlineInputStory"
169-
leftIcon={leftIcon}
169+
icon={icon}
170170
onChange={onChange}
171171
placeholder="This is a placeholder"
172172
outlined

packages/libs/react-ui/src/components/Input/Input.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface IInputProps
2121
> {
2222
leadingText?: string;
2323
leadingTextWidth?: keyof typeof vars.sizes;
24-
leftIcon?: keyof typeof SystemIcon;
24+
icon?: keyof typeof SystemIcon;
2525
rightIcon?: keyof typeof SystemIcon;
2626
disabled?: boolean;
2727
type?: React.HTMLInputTypeAttribute;
@@ -36,15 +36,15 @@ export const Input: FC<IInputProps> = forwardRef<HTMLInputElement, IInputProps>(
3636
outlined,
3737
leadingText,
3838
leadingTextWidth,
39-
leftIcon,
39+
icon,
4040
rightIcon,
4141
disabled = false,
4242
...rest
4343
},
4444
ref,
4545
) {
4646
const RightIcon = rightIcon && SystemIcon[rightIcon];
47-
const LeftIcon = leftIcon && SystemIcon[leftIcon];
47+
const Icon = icon && SystemIcon[icon];
4848

4949
return (
5050
<div
@@ -65,7 +65,7 @@ export const Input: FC<IInputProps> = forwardRef<HTMLInputElement, IInputProps>(
6565
</div>
6666
)}
6767
<div className={inputContainerClass}>
68-
{LeftIcon && <LeftIcon size="md" />}
68+
{Icon && <Icon size="md" />}
6969
<input
7070
ref={ref}
7171
className={inputClass}

packages/libs/react-ui/src/components/InputWrapper/InputWrapper.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { statusVariant } from './InputWrapper.css';
1010
type StoryProps = {
1111
helperText: string;
1212
leadingText: string;
13-
leftIcon: keyof typeof SystemIcon;
13+
icon: keyof typeof SystemIcon;
1414
rightIcon: keyof typeof SystemIcon;
1515
} & IInputWrapperProps;
1616

packages/libs/react-ui/src/components/TextField/TextField.stories.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import React from 'react';
99
type StoryProps = {
1010
helperText: string;
1111
leadingText: string;
12-
leftIcon: keyof typeof SystemIcon;
12+
icon: keyof typeof SystemIcon;
1313
rightIcon: keyof typeof SystemIcon;
1414
} & ITextFieldProps;
1515

@@ -87,7 +87,7 @@ const meta: Meta<StoryProps> = {
8787
defaultValue: { summary: 'false' },
8888
},
8989
},
90-
leftIcon: {
90+
icon: {
9191
description:
9292
'Icon rendered inside the input to the left of the input text.',
9393
options: Object.keys(SystemIcon) as (keyof typeof SystemIcon)[],
@@ -123,14 +123,14 @@ export const Group: Story = {
123123
label: 'Label',
124124
disabled: false,
125125
status: undefined,
126-
leftIcon: 'Account',
126+
icon: 'Account',
127127
rightIcon: undefined,
128128
leadingText: 'Leading',
129129
leadingTextWidth: undefined,
130130
},
131131
render: ({
132132
leadingText,
133-
leftIcon,
133+
icon,
134134
rightIcon,
135135
disabled,
136136
status,
@@ -152,7 +152,7 @@ export const Group: Story = {
152152
inputProps={{
153153
id: 'inputStory',
154154
leadingText,
155-
leftIcon,
155+
icon,
156156
rightIcon,
157157
placeholder: 'This is a placeholder',
158158
}}

0 commit comments

Comments
 (0)