“Designing” with GraphQL

A presentation at React Advanced London in October 2019 in London, UK by Bernardo Raposo

Slide 1

Slide 1

“Designing” with GraphQL

#ReactAdvanced

Slide 2

Slide 2

“Designing” with GraphQL @braposo Hi! I’m Bernardo

TravelRepublic @braposo #ReactAdvanced

Slide 3

Slide 3

@braposo “Designing” with GraphQL brps.me/rrp #ReactAdvanced

Slide 4

Slide 4

@braposo “Designing” with GraphQL brps.me/rtl #ReactAdvanced

Slide 5

Slide 5

@braposo “Designing” with GraphQL brps.me/gqlcss #ReactAdvanced

Slide 6

Slide 6

“Designing” with GraphQL @braposo #ReactAdvanced

Slide 7

Slide 7

“Designing” with GraphQL @braposo Figma API figma.com/developers #ReactAdvanced

Slide 8

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

Slide 9

Slide 9

“Designing” with GraphQL Rigid tree structure @braposo { } “id”: “0:1”, “name”: “Assets”, “type”: “CANVAS”, “children”: [ { “id”: “20:25”, “name”: “Box”, “type”: “COMPONENT”, “children”: [ { “id”: “12:5”, … #ReactAdvanced

Slide 10

Slide 10

“Designing” with GraphQL @braposo Let’s see an example #ReactAdvanced

Slide 11

Slide 11

“Designing” with GraphQL @braposo Get all text styles in a specific frame #ReactAdvanced

Slide 12

Slide 12

“Designing” with GraphQL Get all text styles in a specific frame @braposo

  1. Fetch file data
  2. Get the styles page
  3. Get the typography frame
  4. Extract font styles from each group #ReactAdvanced

Slide 13

Slide 13

“Designing” with GraphQL @braposo #ReactAdvanced

Slide 14

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

Slide 15

“Designing” with GraphQL @braposo What if we could use something simpler? #ReactAdvanced

Slide 16

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

Slide 17

“Designing” with GraphQL @braposo It’s just GraphQL™ #ReactAdvanced

Slide 18

Slide 18

“Designing” with GraphQL @braposo figma-graphql figma-graphql.party #ReactAdvanced

Slide 19

Slide 19

“Designing” with GraphQL @braposo Let’s see it working! #ReactAdvanced

Slide 20

Slide 20

“Designing” with GraphQL @braposo Watch the full talk at brps.me/gqlconf19 #ReactAdvanced

Slide 21

Slide 21

“Designing” with GraphQL @braposo Special thanks: Sara @NikkitaFTW

Thank you!

Andrey @okonetchnikov

Jon @jongold @braposo #ReactAdvanced