1
Fork 0
mirror of https://github.com/Steffo99/bluelib.git synced 2024-12-22 19:44:21 +00:00
This commit is contained in:
Steffo 2020-06-23 22:33:49 +02:00
parent 308a8b00c4
commit 6c5023e2c8
Signed by: steffo
GPG key ID: 896A80F55F7C97F0
5 changed files with 38 additions and 3 deletions

View file

@ -1,7 +1,7 @@
{ {
"private": false, "private": false,
"name": "bluelib", "name": "bluelib",
"version": "0.12.2", "version": "0.12.3",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"source": "src/index.js", "source": "src/index.js",
"main": "dist/index.js", "main": "dist/index.js",

View file

@ -1,12 +1,22 @@
import style from './HButton.less'; import style from './HButton.less';
import {concatClass} from "../../index";
export default function (props) { export default function (props) {
let validityClass = null;
if(props.validity === true) {
validityClass = style.valid;
}
else if(props.validity === false) {
validityClass = style.invalid;
}
return ( return (
<label className={style.label}> <label className={style.label}>
<div className={style.text}>{props.label}</div> <div className={style.text}>{props.label}</div>
<button <button
onClick={props.disabled ? null : props.onClick} onClick={props.disabled ? null : props.onClick}
className={style.button} className={concatClass(style.button, validityClass)}
disabled={props.disabled} disabled={props.disabled}
> >
{props.children} {props.children}

View file

@ -19,3 +19,11 @@
margin-left: 4px; margin-left: 4px;
flex-grow: 2; flex-grow: 2;
} }
.valid {
border: 1px solid @lime !important;
}
.invalid {
border: 1px solid @red !important;
}

View file

@ -1,10 +1,19 @@
import style from './HInput.less'; import style from './HInput.less';
import {concatClass} from "../../index";
export default function (props) { export default function (props) {
let validityClass = null;
if(props.validity === true) {
validityClass = style.valid;
}
else if(props.validity === false) {
validityClass = style.invalid;
}
return ( return (
<label className={style.label}> <label className={style.label}>
<div className={style.text}>{props.label}</div> <div className={style.text}>{props.label}</div>
<input className={style.input} type={props.type} value={props.value} <input className={concatClass(style.input, validityClass)} type={props.type} value={props.value}
onChange={props.onChange} disabled={props.disabled} name={props.name}/> onChange={props.onChange} disabled={props.disabled} name={props.name}/>
</label> </label>
); );

View file

@ -19,3 +19,11 @@
margin-left: 4px; margin-left: 4px;
flex-grow: 2; flex-grow: 2;
} }
.valid {
border: 1px solid @lime !important;
}
.invalid {
border: 1px solid @red !important;
}