Button autoFocus
This commit is contained in:
parent
74badced08
commit
6b72eaa762
|
@ -2,6 +2,11 @@
|
||||||
const r = require('r-dom');
|
const r = require('r-dom');
|
||||||
|
|
||||||
const Button = props => r.button({
|
const Button = props => r.button({
|
||||||
|
ref: input => {
|
||||||
|
if (input && props.autoFocus) {
|
||||||
|
input.focus();
|
||||||
|
}
|
||||||
|
},
|
||||||
className: 'button',
|
className: 'button',
|
||||||
...props,
|
...props,
|
||||||
}, props.children);
|
}, props.children);
|
||||||
|
|
|
@ -35,6 +35,7 @@ const Preferences = withStateHandlers(
|
||||||
r.div([
|
r.div([
|
||||||
r(Button, {
|
r(Button, {
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
autoFocus: true,
|
||||||
onClick: toggle,
|
onClick: toggle,
|
||||||
}, 'Close'),
|
}, 'Close'),
|
||||||
]),
|
]),
|
||||||
|
@ -68,6 +69,7 @@ const Preferences = withStateHandlers(
|
||||||
]),
|
]),
|
||||||
] : [
|
] : [
|
||||||
r(Button, {
|
r(Button, {
|
||||||
|
autoFocus: true,
|
||||||
onClick: toggle,
|
onClick: toggle,
|
||||||
}, 'Cards'),
|
}, 'Cards'),
|
||||||
]));
|
]));
|
||||||
|
|
|
@ -34,6 +34,7 @@ const Preferences = withStateHandlers(
|
||||||
r.div([
|
r.div([
|
||||||
r(Button, {
|
r(Button, {
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
autoFocus: true,
|
||||||
onClick: toggle,
|
onClick: toggle,
|
||||||
}, 'Close'),
|
}, 'Close'),
|
||||||
]),
|
]),
|
||||||
|
@ -130,6 +131,7 @@ const Preferences = withStateHandlers(
|
||||||
]),
|
]),
|
||||||
] : [
|
] : [
|
||||||
r(Button, {
|
r(Button, {
|
||||||
|
autoFocus: true,
|
||||||
onClick: toggle,
|
onClick: toggle,
|
||||||
}, 'Preferences'),
|
}, 'Preferences'),
|
||||||
]));
|
]));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user