-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from "react"; | ||
import { DataEditor, DataEditorProps } from "../../data-editor/data-editor"; | ||
import { | ||
BeautifulWrapper, | ||
Description, | ||
PropName, | ||
useMockDataGenerator, | ||
defaultProps, | ||
} from "../../data-editor/stories/utils"; | ||
import { SimpleThemeWrapper } from "../../stories/story-utils"; | ||
|
||
export default { | ||
title: "Glide-Data-Grid/DataEditor Demos", | ||
|
||
decorators: [ | ||
(Story: React.ComponentType) => ( | ||
<SimpleThemeWrapper> | ||
<BeautifulWrapper | ||
title="Row markers" | ||
description={ | ||
<> | ||
<Description> | ||
Row Markers can be controlled by setting the <PropName>rowMarkers</PropName> prop. | ||
</Description> | ||
</> | ||
}> | ||
<Story /> | ||
</BeautifulWrapper> | ||
</SimpleThemeWrapper> | ||
), | ||
], | ||
}; | ||
|
||
interface RowMarkersProps { | ||
markers: DataEditorProps["rowMarkers"]; | ||
} | ||
|
||
export const RowMarkers: React.VFC<RowMarkersProps> = p => { | ||
const { cols, getCellContent } = useMockDataGenerator(10, false); | ||
|
||
return ( | ||
<DataEditor | ||
{...defaultProps} | ||
getCellContent={getCellContent} | ||
rowMarkers={p.markers} | ||
columns={cols} | ||
rows={400} | ||
/> | ||
); | ||
}; | ||
(RowMarkers as any).args = { | ||
markers: "both", | ||
}; | ||
(RowMarkers as any).argTypes = { | ||
markers: { | ||
control: { type: "select", options: ["both", "checkbox", "number", "none", "clickable-number"] }, | ||
}, | ||
}; |