import React from "react";
import { DataEditorAll as DataEditor } from "../../data-editor-all.js";
import {
BeautifulWrapper,
Description,
PropName,
defaultProps,
useAllMockedKinds,
} from "../../data-editor/stories/utils.js";
import { SimpleThemeWrapper } from "../../stories/story-utils.js";
export default {
title: "Glide-Data-Grid/DataEditor Demos",
decorators: [
(Story: React.ComponentType) => (
You can customize the content alignment by setting contentAlign of a
cell to left, right or center
.
}>
),
],
};
export const ContentAlignment: React.VFC = () => {
const { cols, getCellContent } = useAllMockedKinds();
const mangledGetCellContent = React.useCallback(
cell => {
const [col, _row] = cell;
if (col === 3) {
return {
...getCellContent(cell),
contentAlign: "center",
};
}
if (col === 4) {
return {
...getCellContent(cell),
contentAlign: "right",
};
}
if (col === 5) {
return {
...getCellContent(cell),
contentAlign: "left",
};
}
return getCellContent(cell);
},
[getCellContent]
);
return ;
};