Skip to content

Instantly share code, notes, and snippets.

@PavelLaptev
Created October 4, 2018 09:30
Show Gist options
  • Select an option

  • Save PavelLaptev/4ac41dfffd2e8a6af1f6e04a567ce4be to your computer and use it in GitHub Desktop.

Select an option

Save PavelLaptev/4ac41dfffd2e8a6af1f6e04a567ce4be to your computer and use it in GitHub Desktop.
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