This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Brian Byle
Posted Jun 10 - Read on Facebook

Hello Framers! Between beers I decided to post a lingering question:
- I want to create a component
- for example your standard row in an email app
- it would contain a background, subject line, sender, time stamp. Standard stuff.
- I want to create a new Framer project and add them as needed. My end goal is to create a set of components to speed prototype creation.

I have limited knowledge of modules but understand how they work. Are modules the best approach? Ideas?

Thx in advance!

4 Comments

Jordan Robert Dobson

A Row class would be what you want and placing class code inside module is a good choice.

Do you have everything built for the component already?

Trevor Phillippi

I like to extend the Layer class inside of modules. It allows you to init a Layer/Component with custom properties. Write your constructor inside of the subclass to pull the custom properties out of the options object and use them as needed. This allows you to init rows like:

row = new RowLayer
---height: 100, width: Screen.width
---subject: 'Hi There'
---from: 'John Doe'
---message: 'Hi Jane, I wanted to...'

Brian Byle

Trevor this sounds exactly where I wanted to go. I did some JS training and am familiar with Objects. I just wasn't sure how it translated to Coffee Script.

If you had a link or 2 that could expand on your input it would be much appreciated. Thanks!

Rafael Marin

This is a very simple example of how that implementation could be in Coffeescript. I hope it helps you get started:

https://gist.github.com/marinrafael/5e7d547ac0007f4c5037eaa64dffeadf#file-subclass-coffeescript

Read the entire post on Facebook