-
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.
Add InputGroup and InputAddon components
- Loading branch information
Showing
11 changed files
with
128 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React, { ReactNode } from 'react'; | ||
|
||
import clsx from 'clsx'; | ||
|
||
export interface InputAddonProps { | ||
/** | ||
* The label attached to the label | ||
*/ | ||
children?: ReactNode; | ||
/** | ||
* Custom classes for the label | ||
*/ | ||
className?: string; | ||
} | ||
|
||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
export const InputAddon = ({ | ||
className, | ||
children, | ||
...props | ||
}: InputAddonProps) => { | ||
return ( | ||
<span className={clsx('input-addon', className)} {...props}> | ||
{children} | ||
</span> | ||
); | ||
}; | ||
|
||
export default InputAddon; |
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,2 @@ | ||
export { default } from './InputAddon'; | ||
export type { InputAddonProps } from './InputAddon'; |
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 React, { ReactNode } from 'react'; | ||
|
||
import clsx from 'clsx'; | ||
|
||
export interface InputGroupProps { | ||
/** | ||
* The label attached to the label | ||
*/ | ||
children?: ReactNode; | ||
/** | ||
* Custom classes for the label | ||
*/ | ||
className?: string; | ||
} | ||
|
||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
export const InputGroup = ({ | ||
className, | ||
children, | ||
...props | ||
}: InputGroupProps) => { | ||
return ( | ||
<div className={clsx('input-group', className)} {...props}> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default InputGroup; |
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,2 @@ | ||
export { default } from './InputGroup'; | ||
export type { InputGroupProps } from './InputGroup'; |
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
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
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,45 @@ | ||
import DemoBox from "@docs/components/DemoBox"; | ||
|
||
import { Button, Grid, Input, InputAddon, InputGroup } from "@components"; | ||
import ValkyrieIcon, { viMagnifyingGlass } from "@sippy-platform/valkyrie"; | ||
|
||
export default function InputGroupDemo() { | ||
return ( | ||
<> | ||
<h2>Input Group</h2> | ||
<h3>Input Addon</h3> | ||
<p>The input group allows you to add input addons to an input. These are small text labels.</p> | ||
<DemoBox> | ||
<Grid> | ||
<InputGroup> | ||
<InputAddon>Prefix</InputAddon> | ||
<Input placeholder="Default" /> | ||
</InputGroup> | ||
<InputGroup> | ||
<Input type="email" placeholder="Email" /> | ||
<InputAddon>Suffix</InputAddon> | ||
</InputGroup> | ||
<InputGroup> | ||
<Input type="password" placeholder="Password" /> | ||
<InputAddon>Infix</InputAddon> | ||
<Input type="password" placeholder="Confirm Password" /> | ||
</InputGroup> | ||
<InputGroup> | ||
<InputAddon><ValkyrieIcon icon={viMagnifyingGlass} /></InputAddon> | ||
<Input type="search" placeholder="Search" /> | ||
</InputGroup> | ||
</Grid> | ||
</DemoBox> | ||
<h3>Buttons</h3> | ||
<p>You can also use it to add Buttons</p> | ||
<DemoBox> | ||
<Grid> | ||
<InputGroup> | ||
<Button>Default</Button> | ||
<Input placeholder="Default" /> | ||
</InputGroup> | ||
</Grid> | ||
</DemoBox> | ||
</> | ||
); | ||
} |
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