search input component

This commit is contained in:
Red Adaya 2024-10-17 23:00:05 +08:00
parent 361c29f4cc
commit eb65ea870a
3 changed files with 52 additions and 0 deletions

View File

View File

@ -0,0 +1,32 @@
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import type { Meta, StoryObj } from "@storybook/react";
import { SearchInput } from "./searchinput";
const meta: Meta<typeof SearchInput> = {
title: "Elements/SearchInput",
component: SearchInput,
argTypes: {
className: {
description: "Custom class for styling the input group",
control: { type: "text" },
},
},
};
export default meta;
type Story = StoryObj<typeof SearchInput>;
export const DefaultSearchInput: Story = {
render: (args) => {
const handleSearch = () => {
console.log("Search triggered");
};
return <SearchInput />;
},
args: {
className: "custom-search-input",
},
};

View File

@ -0,0 +1,20 @@
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import { Button } from "./button";
import { Input, InputGroup, InputRightElement } from "./input";
const SearchInput = () => {
return (
<InputGroup className="search-input-group">
<Input placeholder="Search..." />
<InputRightElement>
<Button className="search-button ghost grey">
<i className="fa-sharp fa-solid fa-magnifying-glass"></i>
</Button>
</InputRightElement>
</InputGroup>
);
};
export { SearchInput };