commit
944cfc8547
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-list-ui-library",
|
"name": "react-list-ui-library",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "A Library with storybook for a list app",
|
"description": "A Library with storybook for a list app",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -4,7 +4,7 @@ import { RemoveButton } from './RemoveButton';
|
|||||||
|
|
||||||
type TButtonProps = {
|
type TButtonProps = {
|
||||||
/**
|
/**
|
||||||
* Is this the title of the card.
|
* Is this the type of the Button (Add or Remove).
|
||||||
*/
|
*/
|
||||||
type?: ButtonTypes,
|
type?: ButtonTypes,
|
||||||
/**
|
/**
|
||||||
|
@ -3,11 +3,11 @@ import './style.scss';
|
|||||||
|
|
||||||
type TContainerListProps = {
|
type TContainerListProps = {
|
||||||
/**
|
/**
|
||||||
* Is this the title of the card.
|
* Is this the title of the Container List.
|
||||||
*/
|
*/
|
||||||
title?: string,
|
title?: string,
|
||||||
/**
|
/**
|
||||||
* Is this the child component of the card. (The content)
|
* Is this the child component of the Container List. (The content)
|
||||||
*/
|
*/
|
||||||
children?: JSX.Element,
|
children?: JSX.Element,
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,10 @@ export type TInputProps = {
|
|||||||
* Is this the text you want to add to the input placeholder
|
* Is this the text you want to add to the input placeholder
|
||||||
*/
|
*/
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
|
/**
|
||||||
|
* Is this the value of the input
|
||||||
|
*/
|
||||||
|
value?: string
|
||||||
/**
|
/**
|
||||||
* Is this the onChange event of the input
|
* Is this the onChange event of the input
|
||||||
*/
|
*/
|
||||||
@ -14,9 +18,10 @@ export type TInputProps = {
|
|||||||
|
|
||||||
export const Input:FC<TInputProps> = ({
|
export const Input:FC<TInputProps> = ({
|
||||||
placeholder = '',
|
placeholder = '',
|
||||||
|
value = '',
|
||||||
onChange = (e) => {}
|
onChange = (e) => {}
|
||||||
}) => {
|
}) => {
|
||||||
return(
|
return(
|
||||||
<input className='input' placeholder={placeholder} type='text' onChange={onChange} />
|
<input className='input' value={value} placeholder={placeholder} type='text' onChange={onChange} />
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -1,10 +1,11 @@
|
|||||||
.input{
|
.input{
|
||||||
width: 100%;
|
width: 95%;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
padding-left: 15px;
|
||||||
&:focus{
|
&:focus{
|
||||||
border: 1px solid #000;
|
border: 1px solid #000;
|
||||||
}
|
}
|
||||||
|
@ -5,23 +5,27 @@ import { on } from 'events';
|
|||||||
|
|
||||||
type TListProps = {
|
type TListProps = {
|
||||||
/**
|
/**
|
||||||
* Is this the title of the card.
|
* Is this the list of items as an array.
|
||||||
*/
|
*/
|
||||||
list: TItem[]
|
list: TItem[]
|
||||||
/**
|
/**
|
||||||
* Is this the title of the card.
|
* Is this the text of the placeholder of the input of the List.
|
||||||
*/
|
*/
|
||||||
placeholderInput?: string
|
placeholderInput?: string
|
||||||
/**
|
/**
|
||||||
* Is this the onChange event of the input
|
* Is this the text of the value of the input of the List.
|
||||||
|
*/
|
||||||
|
valueInput?: string
|
||||||
|
/**
|
||||||
|
* Is this the onChange event of the input to add
|
||||||
*/
|
*/
|
||||||
onChangeInput?: ChangeEventHandler<HTMLInputElement>
|
onChangeInput?: ChangeEventHandler<HTMLInputElement>
|
||||||
/**
|
/**
|
||||||
* Is this the onClick Event of the button.
|
* Is this the onClick Event of the button to add an item.
|
||||||
*/
|
*/
|
||||||
onClickAddItem?: MouseEventHandler<HTMLButtonElement> | undefined
|
onClickAddItem?: MouseEventHandler<HTMLButtonElement> | undefined
|
||||||
/**
|
/**
|
||||||
* Is this the onClick Event of the button.
|
* Is this the onClick Event of the button to Remove a Item.
|
||||||
*/
|
*/
|
||||||
onClickRemoveItem?: ((index: number) => void)
|
onClickRemoveItem?: ((index: number) => void)
|
||||||
/**
|
/**
|
||||||
@ -33,6 +37,7 @@ type TListProps = {
|
|||||||
const List: FC<TListProps> = ({
|
const List: FC<TListProps> = ({
|
||||||
list,
|
list,
|
||||||
placeholderInput,
|
placeholderInput,
|
||||||
|
valueInput = '',
|
||||||
onChangeInput,
|
onChangeInput,
|
||||||
onClickAddItem,
|
onClickAddItem,
|
||||||
onClickRemoveItem,
|
onClickRemoveItem,
|
||||||
@ -60,6 +65,7 @@ const List: FC<TListProps> = ({
|
|||||||
<div>
|
<div>
|
||||||
<Input
|
<Input
|
||||||
placeholder={placeholderInput}
|
placeholder={placeholderInput}
|
||||||
|
value={valueInput}
|
||||||
onChange={onChangeInput}
|
onChange={onChangeInput}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user