Skip to content

Commit

Permalink
feat: basic input
Browse files Browse the repository at this point in the history
  • Loading branch information
ink-victor committed Nov 22, 2024
1 parent e2ab2e6 commit 48df411
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/components/Input/Input.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Meta, StoryObj } from "@storybook/react";
import { Input, InputProps } from "./Input";

const meta: Meta<InputProps> = {
title: "Components/Input",
component: Input,
tags: ["autodocs"],
args: {
placeholder: "Placeholder",
type: "text",
},
};

export default meta;
type Story = StoryObj<typeof meta>;

export const Simple: Story = {
args: {},
};
24 changes: 24 additions & 0 deletions src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, { forwardRef } from "react";
import { classNames, resetClasses } from "../../util/classes";

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {
className?: string;
}

export const Input = forwardRef<HTMLInputElement, InputProps>(
({ className, ...props }, ref) => {
return (
<input
ref={ref}
className={classNames(
resetClasses,
"ink-w-full ink-rounded-8 ink-bg-background-container ink-p-2 ink-text-body-2",
"focus:ink-outline focus:ink-outline-1 ink-outline-text-on-secondary",
className
)}
{...props}
/>
);
}
);
1 change: 1 addition & 0 deletions src/components/Input/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./Input";
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./Button";
export * from "./Input";
export * from "./Modal";
export * from "./SegmentedControl";
export * from "./Typography";
Expand Down

0 comments on commit 48df411

Please sign in to comment.