Created
October 4, 2018 09:30
-
-
Save PavelLaptev/4ac41dfffd2e8a6af1f6e04a567ce4be to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import * as React from "react"; | |
| import { PropertyControls, ControlType, Stack } from "framer"; | |
| import { List_Item } from "./canvas"; | |
| // Define type of property | |
| interface Props { | |
| rows: number; | |
| } | |
| export class RandomMockDataList extends React.Component<Props> { | |
| // Set default properties | |
| static defaultProps = { | |
| rows: 10, | |
| ...Stack.defaultProps | |
| }; | |
| // Items shown in property panel | |
| static propertyControls: PropertyControls = { | |
| rows: { type: ControlType.Number, title: "Rows", max: 20, min: 2 }, | |
| ...Stack.propertyControls | |
| }; | |
| render() { | |
| const rowCount = this.props.rows; | |
| return ( | |
| <Stack {...this.props}> | |
| {Array(rowCount) | |
| .fill(0) | |
| .map((_, idx) => ( | |
| <List_Item | |
| fatBurnt={`${(Math.random() * 100).toFixed(1)}g`} | |
| key={idx} | |
| /> | |
| ))} | |
| </Stack> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment