Skip to content

Commit 60fe482

Browse files
committed
enhancement: added startAdornment for input
1 parent 89c5671 commit 60fe482

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

src/components/common/layout/page-layout/footer/constants/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export const links: Links = {
88
href: '/',
99
},
1010
{
11-
title: 'Організація',
12-
href: '/organization',
11+
title: 'Організації',
12+
href: '/organizations',
1313
},
1414
{
1515
title: 'Ціни',

src/components/common/ui/input/Input.styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { InputVariant } from '@/components/common/ui/input/types';
44

55
export const formControl = (variant: InputVariant): SxProps<Theme> => ({
66
'.MuiInputBase-root': {
7-
m: '10px 0 0 0',
7+
m: 0,
88
border: '2px solid',
99
borderColor: 'gray.400',
1010

src/components/common/ui/input/Input.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
'use client';
22

33
import React, { FC, useState } from 'react';
4-
import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline';
4+
import {
5+
EyeIcon,
6+
EyeSlashIcon,
7+
MagnifyingGlassIcon,
8+
} from '@heroicons/react/24/outline';
59
import {
610
FormControl,
711
IconButton,
@@ -28,6 +32,7 @@ interface InputProps extends InputPropsMUI {
2832
password?: boolean;
2933
sx?: SxProps<Theme>;
3034
fullWidth?: boolean;
35+
isSearch?: boolean;
3136
}
3237

3338
const Input: FC<InputProps> = ({
@@ -39,6 +44,7 @@ const Input: FC<InputProps> = ({
3944
password = false,
4045
sx = {},
4146
fullWidth = false,
47+
isSearch = false,
4248
...props
4349
}) => {
4450
const [showPassword, setShowPassword] = useState(!password);
@@ -47,16 +53,22 @@ const Input: FC<InputProps> = ({
4753
setShowPassword((prevShowPassword) => !prevShowPassword);
4854
};
4955

50-
const eyeColor =
56+
const iconColor =
5157
variant === 'white' ? theme.palette.gray[300] : theme.palette.gray[400];
5258

59+
const startAdornment = isSearch ? (
60+
<InputAdornment position="start">
61+
<MagnifyingGlassIcon width={24} height={24} color={iconColor} />
62+
</InputAdornment>
63+
) : null;
64+
5365
const endAdornment = password ? (
5466
<InputAdornment position="end">
5567
<IconButton edge="end" onClick={handleTogglePasswordVisibility}>
5668
{showPassword ? (
57-
<EyeIcon width={24} height={24} color={eyeColor} />
69+
<EyeIcon width={24} height={24} color={iconColor} />
5870
) : (
59-
<EyeSlashIcon width={24} height={24} color={eyeColor} />
71+
<EyeSlashIcon width={24} height={24} color={iconColor} />
6072
)}
6173
</IconButton>
6274
</InputAdornment>
@@ -77,6 +89,7 @@ const Input: FC<InputProps> = ({
7789
</InputLabel>
7890
)}
7991
<InputMUI
92+
startAdornment={startAdornment}
8093
endAdornment={endAdornment}
8194
sx={styles.input(variant)}
8295
disableUnderline

0 commit comments

Comments
 (0)