Skip to content

Commit

Permalink
Merge pull request #30 from inkonchain/feat/basic-input
Browse files Browse the repository at this point in the history
feat: basic input
  • Loading branch information
ink-victor authored Nov 22, 2024
2 parents 9096e9e + feb9129 commit c186b6b
Show file tree
Hide file tree
Showing 4 changed files with 44 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: {},
};
23 changes: 23 additions & 0 deletions src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { forwardRef } from "react";
import { classNames } 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(
"ink:w-full ink:font-default ink:rounded-8 ink:bg-background-container ink:p-2 ink:text-body-2 ink:text-text-default",
"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 c186b6b

Please sign in to comment.