Polish editable page header interactions

pull/10616/head
Alex P 2017-05-23 01:57:37 -07:00
parent 21c5a18644
commit 4f732b89c9
5 changed files with 54 additions and 39 deletions

View File

@ -21,15 +21,15 @@ class DashboardEditHeader extends Component {
return (
<div className="page-header full-width">
<div className="page-header__container">
<div className="page-header__left">
<input
className="page-header--editing"
autoFocus={true}
value={name}
placeholder="Name this Dashboard"
onChange={e => this.handleChange(e.target.value)}
/>
</div>
<input
className="page-header--editing"
autoFocus={true}
value={name}
onChange={e => this.handleChange(e.target.value)}
placeholder="Name this Dashboard"
spellCheck={false}
autoComplete={false}
/>
<ConfirmButtons item={name} onConfirm={onSave} onCancel={onCancel} />
</div>
</div>

View File

@ -110,31 +110,31 @@ export const RuleHeader = React.createClass({
onKeyDown={e => this.handleEditName(e, rule)}
onBlur={() => this.handleEditNameBlur(rule)}
placeholder="Name your rule"
spellCheck={false}
autoComplete={false}
/>
: <h1
className="page-header__title page-header--editable kapacitor-theme"
onClick={this.toggleEditName}
data-for="rename-kapacitor-tooltip"
data-tip="Click to Rename"
>
{rule.name}
<span className="icon pencil" />
<ReactTooltip
id="rename-kapacitor-tooltip"
delayShow={200}
effect="solid"
html={true}
offset={{top: 2}}
place="bottom"
class="influx-tooltip kapacitor-tooltip place-bottom"
/>
</h1>
: <div className="page-header__left">
<h1
className="page-header__title page-header--editable kapacitor-theme"
onClick={this.toggleEditName}
data-for="rename-kapacitor-tooltip"
data-tip="Click to Rename"
>
{rule.name}
<span className="icon pencil" />
<ReactTooltip
id="rename-kapacitor-tooltip"
delayShow={200}
effect="solid"
html={true}
offset={{top: 2}}
place="bottom"
class="influx-tooltip kapacitor-tooltip place-bottom"
/>
</h1>
</div>
return (
<div className="page-header__left">
{name}
</div>
)
return name
},
})

View File

@ -1,11 +1,22 @@
import React, {PropTypes} from 'react'
import classnames from 'classnames'
const ConfirmButtons = ({onConfirm, item, onCancel}) => (
const ConfirmButtons = ({onConfirm, item, onCancel, buttonSize}) => (
<div className="confirm-buttons">
<button className="btn btn-xs btn-info" onClick={() => onCancel(item)}>
<button
className={classnames('btn btn-info btn-square', {
[buttonSize]: buttonSize,
})}
onClick={() => onCancel(item)}
>
<span className="icon remove" />
</button>
<button className="btn btn-xs btn-success" onClick={() => onConfirm(item)}>
<button
className={classnames('btn btn-success btn-square', {
[buttonSize]: buttonSize,
})}
onClick={() => onConfirm(item)}
>
<span className="icon checkmark" />
</button>
</div>
@ -17,6 +28,10 @@ ConfirmButtons.propTypes = {
onConfirm: func.isRequired,
item: oneOfType([shape(), string]),
onCancel: func.isRequired,
buttonSize: string,
}
ConfirmButtons.defaultProps = {
buttonSize: 'btn-sm',
}
export default ConfirmButtons

View File

@ -2,12 +2,14 @@
.dropdown-toggle {
height: 38px;
padding-left: 0;
padding-right: (11px + 12px); // caret width + offset
padding-top: 0;
padding-bottom: 0;
min-width: 50px;
width: auto;
border: 0;
background-color: transparent;
text-transform: none;
padding-right: (11px + 12px); // caret width + offset
font-size: $page-header-size;
font-weight: $page-header-weight;
transition: color 0.25s ease;

View File

@ -27,8 +27,6 @@
font-weight: $page-header-weight;
padding: 0;
flex: 1;
position: relative;
top: -1px;
&:focus {
color: $c-pool;