“Designing” with GraphQL
@braposo
Hi!
I’m Bernardo
TravelRepublic
@braposo
#ReactAdvanced
Slide 3
@braposo
“Designing” with GraphQL
brps.me/rrp #ReactAdvanced
Slide 4
@braposo
“Designing” with GraphQL
brps.me/rtl #ReactAdvanced
Slide 5
@braposo
“Designing” with GraphQL
brps.me/gqlcss #ReactAdvanced
Slide 6
“Designing” with GraphQL
@braposo
#ReactAdvanced
Slide 7
“Designing” with GraphQL
@braposo
Figma API figma.com/developers #ReactAdvanced
Slide 8
“Designing” with GraphQL
Multiple
REST endpoints
@braposo
GET /v1/files/:key
GET /v1/images/:key
GET /v1/teams/:team_id/projects
GET /v1/projects/:project_id/files
GET /v1/files/:key/comments
POST /v1/files/:key/comments
GET /v1/teams/:team_id/components
GET /v1/teams/:team_id/styles
#ReactAdvanced
“Designing” with GraphQL
@braposo
Let’s see an example
#ReactAdvanced
Slide 11
“Designing” with GraphQL
@braposo
Get all text styles in a specific frame
#ReactAdvanced
Slide 12
“Designing” with GraphQL
Get all text styles in a specific frame
@braposo
Fetch file data
Get the styles page
Get the typography frame
Extract font styles from each group
#ReactAdvanced
Slide 13
“Designing” with GraphQL
@braposo
#ReactAdvanced
Slide 14
“Designing” with GraphQL
Get all text styles in a specific frame
@braposo
[
{
}
…
“name”: “caption”,
“styles”: {
“large”: {
“family”: “Arimo”,
“size”: “16px”,
“weight”: 400,
“lineheight”: “140%”,
“spacing”: “3.2px”
},
…
}
#ReactAdvanced
Slide 15
“Designing” with GraphQL
@braposo
What if we could use something simpler? #ReactAdvanced
Slide 16
“Designing” with GraphQL
Get all text styles in a specific frame
@braposo
file(id: “fileID”) {
pages(name: “styles”) {
frames(name: “typography”) {
groups {
name
texts {
name
styles {
fontSize
fontFamily
fontWeight
}
…
} #ReactAdvanced
Slide 17
“Designing” with GraphQL
@braposo
It’s just GraphQL™
#ReactAdvanced
Slide 18
“Designing” with GraphQL
@braposo
figma-graphql
figma-graphql.party
#ReactAdvanced
Slide 19
“Designing” with GraphQL
@braposo
Let’s see it working!
#ReactAdvanced
Slide 20
“Designing” with GraphQL
@braposo
Watch the full talk at
brps.me/gqlconf19 #ReactAdvanced
Slide 21
“Designing” with GraphQL
@braposo
Special thanks:
Sara
@NikkitaFTW