Skip to content

Commit

Permalink
refactor(InputGroup): increase target size
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Jul 21, 2024
1 parent 9c4f4fb commit a558ead
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/components/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export const Input = forwardRef(function Input(
size === "md" && "px-2",
size === "lg" && "px-2.5",
)}
onClickCapture={(event) => {
// Increase target size of input
if (event.target === event.currentTarget) {
localRef.current.focus({ preventScroll: true });
}
}}
>
{addonStart}
{input}
Expand Down
4 changes: 2 additions & 2 deletions src/components/InputGroup.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Story = StoryObj<typeof meta>;

export const WithInputOutlined = {
args: {
addonStart: <MagnifyingGlassIcon className="size-6" />,
addonStart: <MagnifyingGlassIcon className="pointer-events-none size-6" />,
addonEnd: (
<ButtonPlain size="sm" shape="pill">
Go
Expand All @@ -35,7 +35,7 @@ export const WithInputOutlined = {

export const WithInputFilled = {
args: {
addonStart: <MagnifyingGlassIcon className="size-6" />,
addonStart: <MagnifyingGlassIcon className="pointer-events-none size-6" />,
addonEnd: (
<ButtonSecondary size="sm" shape="pill">
Go
Expand Down

0 comments on commit a558ead

Please sign in to comment.