diff options
Diffstat (limited to 'public/projects/react-small-apps/apps/todos/src/components/forms/Button')
| -rw-r--r-- | public/projects/react-small-apps/apps/todos/src/components/forms/Button/Button.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/public/projects/react-small-apps/apps/todos/src/components/forms/Button/Button.js b/public/projects/react-small-apps/apps/todos/src/components/forms/Button/Button.js new file mode 100644 index 0000000..f9c7956 --- /dev/null +++ b/public/projects/react-small-apps/apps/todos/src/components/forms/Button/Button.js @@ -0,0 +1,17 @@ +function Button({ children, modifiers, onClickHandler, type = "button" }) { + let classNames = "btn"; + + if (modifiers && modifiers.length > 0) { + for (let i = 0; i < modifiers.length; i++) { + classNames += ` btn--${modifiers[i]}`; + } + } + + return ( + <button type={type} className={classNames} onClick={onClickHandler}> + {children} + </button> + ); +} + +export default Button; |
