Improving the homepage with customer testimonials
In this tutorial, we will be adding a customer testimonials section to our home page.
Customers photos
Creating another Data² Drive
First, add a new Data² Drive and rename it to "Customers Drive".
To add a folder:
- Click on the folder icon next to the Trash icon in the top right corner.
- Click on the folder that was added.
- Click again on the name to rename.
- Rename it to
photos
.
Uploading a photo for each customer
Let's add two new fields for our customers, photo
and testimonial
. For this, we will change the schema
parameter of the Customers Table
:
- Select the
Customers Table
. - Click on
Schema
. - Click on
Add Item
. - In
Title
writephoto
and inComponent
selectdata2-core-types@File
. - Add another item by clicking on
Add Item
. - In
Title
writetestimonial
and inComponent
selectdata2-core-primitives@String
.
In the Customer CRUD Artboard, select one of the text fields and in the Inspector, click on the duplicate icon.
Reposition this new text field, and change the Field
parameter to testimonial
.
Draw another Block
and change its type to data2-blocks@FileField
. Configure it with:
- In
Dataset
selectAll Customers
. - In
Field
selectPhoto
. - Under
Folder
, select theDrive Clients
and select thephotos
folder.
Click the Preview button on the Customer CRUD Artboard, and add new clients.
Put testimonials on the home page
On the Artboard
of the home page, add a Block
to be the testimonials section. In this block:
- In the parameter
Children Mode
putcols
. - In the
Repeat
parameter, putAll Customers
. - In the
Repeat Reference
parameter, putcustomer
.
This means that all Blocks
that are direct children, that is, that are inside that Block
without another Block
in between, will be repeated.
Draw another Block
inside the section and in the Position
parameter, disable Free Transform
. In this Block
, draw two other Blocks
: one for the photo and another for the testimonial of each customer.
In the testimonial Block
:
- In the
Text
parameter, click onf()
and selectdata2-core-types@Reference
. - Click on
Text
to browse and in the text field, putcustomerRepeater.testimonial
.
In the photo Block
:
- Click on
f()
and change the type todata2-core-types@Background
. - Click on the
...
icon next tof()
and selectBreak Param
. This allows you to "navigate into" the parameter, and allows you to change the type of each field of the parameter. - Click
Fill
to navigate. - In the
Image
parameter, clickf()
and selectdata2-core-types@Reference
. - Click on
Image
to browse. - In the text field, write
customerRepeater.foto.fileUrl
. Autocomplete will help with this task.
As usual, click on the Preview
of the Artboard
to see the result of your work!
Make adjustments to the placement and styling of the Blocks
as you wish, such as centering the text, removing the blue color from the Blocks
, etc.