1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-24 23:37:51 +01:00

24 lines
785 B
React
Raw Normal View History

import Component from '../Component';
export default class Cell extends Component {
view(vnode) {
const spans = [];
for (const device of ['desktop', 'tablet', 'phone']) {
const key = `columnspan-${device}`;
if (this.attrs.has(key)) {
spans.push(`mdc-layout-grid__cell--span-${this.attrs.get(key)}-${device}`);
}
}
this.attrs.addClassNames('mdc-layout-grid__cell', {
[`mdc-layout-grid__cell--span-${this.attrs.columnspan}`]: this.attrs.has('columnspan'),
[`mdc-layout-grid__cell--order-${this.attrs.get('order')}`]: this.attrs.has('order'),
[`mdc-layout-grid__cell--align-${this.attrs.get('align')}`]: this.attrs.has('align')
}, spans);
return <div {...this.attrs.all()}>
{vnode.children}
</div>;
}
}