Undelete the Layout

This commit is contained in:
Aleksej Komarov
2020-04-19 19:36:41 +03:00
parent fe81f64dcb
commit 8b63e1acf7
3 changed files with 58 additions and 10 deletions
-9
View File
@@ -1,9 +0,0 @@
/**
* DELETE ME when you're done moving to Window.
*/
import { Window } from '../layouts';
const Layout = Window;
export { Layout };
-1
View File
@@ -15,7 +15,6 @@ export { Icon } from './Icon';
export { Input } from './Input';
export { Knob } from './Knob';
export { LabeledList } from './LabeledList';
export { Layout } from './Layout';
export { NoticeBox } from './NoticeBox';
export { NumberInput } from './NumberInput';
export { ProgressBar } from './ProgressBar';
+58
View File
@@ -0,0 +1,58 @@
import { classes } from 'common/react';
import { tridentVersion } from '../byond';
/**
* Brings Layout__content DOM element back to focus.
*
* Commonly used to keep the content scrollable in IE.
*/
export const refocusLayout = () => {
// IE8: Focus method is seemingly fucked.
if (tridentVersion <= 4) {
return;
}
const element = document.getElementById('Layout__content');
if (element) {
element.focus();
}
};
export const Layout = props => {
const {
className,
theme = 'nanotrasen',
children,
} = props;
return (
<div className={'theme-' + theme}>
<div
className={classes([
'Layout',
className,
])}>
{children}
</div>
</div>
);
};
const LayoutContent = props => {
const {
className,
scrollable,
children,
} = props;
return (
<div
id="Layout__content"
className={classes([
'Layout__content',
scrollable && 'Layout__content--scrollable',
className,
])}>
{children}
</div>
);
};
Layout.Content = LayoutContent;