@coveord/plasma-mantine
Version:
A Plasma flavoured Mantine theme
37 lines (36 loc) • 1.65 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Box, Center, Grid, SegmentedControl, Space } from '@mantine/core';
import { TableComponentsOrder } from '../Table';
import { useTableContext } from '../TableContext';
export const TableLayoutControl = ()=>{
const { layouts, store } = useTableContext();
return layouts.length > 1 ? /*#__PURE__*/ _jsx(Grid.Col, {
order: TableComponentsOrder.LayoutControl,
span: "content",
children: /*#__PURE__*/ _jsx(SegmentedControl, {
data: layouts.map(({ displayName, Icon })=>({
value: displayName,
label: /*#__PURE__*/ _jsxs(Center, {
children: [
Icon ? /*#__PURE__*/ _jsxs(_Fragment, {
children: [
/*#__PURE__*/ _jsx(Icon, {
height: 16
}),
/*#__PURE__*/ _jsx(Space, {
w: "xs"
})
]
}) : null,
/*#__PURE__*/ _jsx(Box, {
children: displayName
})
]
})
})),
value: store.state.layout === null ? layouts[0].displayName : store.state.layout,
onChange: store.setLayout
})
}) : null;
};
//# sourceMappingURL=TableLayoutControl.js.map