feat: numbers

This commit is contained in:
cha0s 2020-06-19 22:19:17 -05:00
parent b8fcda29dc
commit b920db1ff9
3 changed files with 46 additions and 2 deletions

View File

@ -0,0 +1,20 @@
:scope {
display: flex;
}
input {
max-width: 5em;
}
.controls {
display: flex;
flex-direction: column;
}
button {
border-left: none;
&:first-child {
border-bottom: none;
}
}

View File

@ -1,8 +1,14 @@
import {compose} from '@avocado/core';
import contempo from 'contempo';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import propertyPropTypes from './property-prop-types'; import propertyPropTypes from './property-prop-types';
const decorate = compose(
contempo(require('./number.raw.scss')),
);
const Number = ({ const Number = ({
options, options,
value, value,
@ -17,7 +23,19 @@ const Number = ({
))} ))}
</select> </select>
) )
: <input type="text" value={value} /> : (
<>
<input
onWheel={(e) => (e.preventDefault(), false)}
type="text"
value={value}
/>
<div className="controls">
<button type="button">+</button>
<button type="button">-</button>
</div>
</>
)
} }
</span> </span>
); );
@ -29,5 +47,5 @@ Number.propTypes = {
export default { export default {
type: 'number', type: 'number',
component: Number, component: decorate(Number),
}; };

View File

@ -119,6 +119,12 @@ fieldset {
width: 100%; width: 100%;
} }
button {
background: #222222;
border: 1px solid rgba(255, 255, 255, 0.1);
color: #ffffff;
}
button, input[type="checkbox"], input[type="checkbox"] + label { button, input[type="checkbox"], input[type="checkbox"] + label {
cursor: pointer; cursor: pointer;
} }