mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-16 04:00:29 +03:00
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
3d885ec262
commit
a83aecaa69
13 changed files with 850 additions and 708 deletions
|
|
@ -6,13 +6,14 @@ import Text from '../text/Text';
|
|||
import RawIcon from '../system-icons/RawIcon';
|
||||
import { blurOnBubbling } from './script';
|
||||
|
||||
function Button({
|
||||
const Button = React.forwardRef(({
|
||||
id, className, variant, iconSrc,
|
||||
type, onClick, children, disabled,
|
||||
}) {
|
||||
}, ref) => {
|
||||
const iconClass = (iconSrc === null) ? '' : `btn-${variant}--icon`;
|
||||
return (
|
||||
<button
|
||||
ref={ref}
|
||||
id={id === '' ? undefined : id}
|
||||
className={`${className ? `${className} ` : ''}btn-${variant} ${iconClass} noselect`}
|
||||
onMouseUp={(e) => blurOnBubbling(e, `.btn-${variant}`)}
|
||||
|
|
@ -26,7 +27,7 @@ function Button({
|
|||
{typeof children !== 'string' && children }
|
||||
</button>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Button.defaultProps = {
|
||||
id: '',
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import './Input.scss';
|
|||
import TextareaAutosize from 'react-autosize-textarea';
|
||||
|
||||
function Input({
|
||||
id, label, value, placeholder,
|
||||
id, label, name, value, placeholder,
|
||||
required, type, onChange, forwardRef,
|
||||
resizable, minHeight, onResize, state,
|
||||
onKeyDown,
|
||||
|
|
@ -17,6 +17,7 @@ function Input({
|
|||
? (
|
||||
<TextareaAutosize
|
||||
style={{ minHeight: `${minHeight}px` }}
|
||||
name={name}
|
||||
id={id}
|
||||
className={`input input--resizable${state !== 'normal' ? ` input--${state}` : ''}`}
|
||||
ref={forwardRef}
|
||||
|
|
@ -33,6 +34,7 @@ function Input({
|
|||
<input
|
||||
ref={forwardRef}
|
||||
id={id}
|
||||
name={name}
|
||||
className={`input ${state !== 'normal' ? ` input--${state}` : ''}`}
|
||||
type={type}
|
||||
placeholder={placeholder}
|
||||
|
|
@ -49,6 +51,7 @@ function Input({
|
|||
|
||||
Input.defaultProps = {
|
||||
id: null,
|
||||
name: '',
|
||||
label: '',
|
||||
value: '',
|
||||
placeholder: '',
|
||||
|
|
@ -65,6 +68,7 @@ Input.defaultProps = {
|
|||
|
||||
Input.propTypes = {
|
||||
id: PropTypes.string,
|
||||
name: PropTypes.string,
|
||||
label: PropTypes.string,
|
||||
value: PropTypes.string,
|
||||
placeholder: PropTypes.string,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue