-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from zimmerman-team/feat/add-input-component
feat: add Input component
- Loading branch information
Showing
5 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Input } from "./input"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { fn, userEvent, within, expect } from "@storybook/test"; | ||
import Input from "./input"; | ||
|
||
const meta = { | ||
title: "Example/Input", | ||
component: Input, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
tags: ["autodocs"], | ||
argTypes: { | ||
backgroundColor: { control: "color" }, | ||
}, | ||
args: { backgroundColor: "yellow" }, | ||
} satisfies Meta<typeof Input>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
backgroundColor: "yellow", | ||
}, | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
const user = userEvent.setup(); | ||
expect(canvas.getByRole("textbox")).toBeInTheDocument(); | ||
await user.type(canvas.getByRole("textbox"), "Hello, World!"); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import { css } from "@emotion/react"; | ||
import React from "react"; | ||
|
||
export default function Input({ | ||
backgroundColor, | ||
}: { | ||
backgroundColor: string; | ||
}) { | ||
return ( | ||
<div> | ||
<input | ||
type="text" | ||
css={css` | ||
display: flex; | ||
width: 236px; | ||
height: 32px; | ||
padding: 4px 8px; | ||
align-items: center; | ||
align-content: center; | ||
gap: 8px; | ||
flex-wrap: wrap; | ||
border-radius: 5px; | ||
background: ${backgroundColor ?? "#ebebeb"}; | ||
border: none; | ||
`} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./components/buttons"; | ||
export * from "./components/input"; |