Skip to contents

The `quarto_website` object contain the data of the homepage for a Quarto Website that was drawn in a Figma file. In other words, a homepage was drawn in Figma, and then, it was imported to R trough the figma package.

Usage

quarto_website

Format

An object of class response, produced by httr HTTP methods (e.g. httr::GET());

Details

This Figma file contains a single page/canvas, and each HTML component is a separate object in the Figma file. The name of each object in the page/canvas correspond to the CSS selector used to style this HTML component in a real Quarto Website.

This is a interesting structure, because you can use the name and the attributes of each object to build custom CSS code, that maybe matches the style of a webpage.

Is worth mentioning, that the quarto_website object is a httr::response object returned by figma::get_figma_file(). This httr::response object is just a simple R list with class response. The elements of this list and their description are:

  • url: The URL used in the HTTP request made to the Figma API;

  • status_code: The HTTP status code returned by the Figma API;

  • headers and all_headers: The list of headers returned by the Figma API;

  • cookies: A named list of cookies returned by the Figma API;

  • content: The body of the response, as raw vector. See httr::content() for various ways to parse this content;

  • date and times: Timing information about the HTTP request made to the Figma API;

  • handle: The handle associated with the url;

  • request: The URL, HTTP method and options used in the HTTP request made to the Figma API;

All data of the Figma file is stored in the content element. However, this data is in raw format (i.e. in raw bytes). To convert these raw bytes into a useful format like a R list, or a string, you should use the httr::content() function. See vignette("figma") for a detailed description of the data present in this content element;

Examples

library(figma)
str(quarto_website)
#> List of 10
#>  $ url        : chr "https://api.figma.com/v1/files/Y7jJJ5KHcG7hjuZVeRPZWq"
#>  $ status_code: int 200
#>  $ headers    :List of 14
#>   ..$ content-type                : chr "application/json; charset=utf-8"
#>   ..$ transfer-encoding           : chr "chunked"
#>   ..$ connection                  : chr "keep-alive"
#>   ..$ date                        : chr "Thu, 08 Dec 2022 11:56:48 GMT"
#>   ..$ access-control-allow-origin : chr "*"
#>   ..$ access-control-allow-headers: chr "Content-Type, X-Figma-Token, Authorization"
#>   ..$ cache-control               : chr "no-cache, no-store"
#>   ..$ vary                        : chr "X-Figma-Token,Authorization"
#>   ..$ x-cache                     : chr "Miss from cloudfront"
#>   ..$ via                         : chr "1.1 52f920f33acb1140004f09dd7ec8ef94.cloudfront.net (CloudFront)"
#>   ..$ x-amz-cf-pop                : chr "GRU1-C1"
#>   ..$ alt-svc                     : chr "h3=\":443\"; ma=86400"
#>   ..$ x-amz-cf-id                 : chr "lYluVe85gAqAWDyUEAtBV_mb5IkHmz8p_4q9qMVJ79-wFAtqF3HG_g=="
#>   ..$ strict-transport-security   : chr "max-age=31536000; includeSubDomains; preload"
#>   ..- attr(*, "class")= chr [1:2] "insensitive" "list"
#>  $ all_headers:List of 1
#>   ..$ :List of 3
#>   .. ..$ status : int 200
#>   .. ..$ version: chr "HTTP/1.1"
#>   .. ..$ headers:List of 14
#>   .. .. ..$ content-type                : chr "application/json; charset=utf-8"
#>   .. .. ..$ transfer-encoding           : chr "chunked"
#>   .. .. ..$ connection                  : chr "keep-alive"
#>   .. .. ..$ date                        : chr "Thu, 08 Dec 2022 11:56:48 GMT"
#>   .. .. ..$ access-control-allow-origin : chr "*"
#>   .. .. ..$ access-control-allow-headers: chr "Content-Type, X-Figma-Token, Authorization"
#>   .. .. ..$ cache-control               : chr "no-cache, no-store"
#>   .. .. ..$ vary                        : chr "X-Figma-Token,Authorization"
#>   .. .. ..$ x-cache                     : chr "Miss from cloudfront"
#>   .. .. ..$ via                         : chr "1.1 52f920f33acb1140004f09dd7ec8ef94.cloudfront.net (CloudFront)"
#>   .. .. ..$ x-amz-cf-pop                : chr "GRU1-C1"
#>   .. .. ..$ alt-svc                     : chr "h3=\":443\"; ma=86400"
#>   .. .. ..$ x-amz-cf-id                 : chr "lYluVe85gAqAWDyUEAtBV_mb5IkHmz8p_4q9qMVJ79-wFAtqF3HG_g=="
#>   .. .. ..$ strict-transport-security   : chr "max-age=31536000; includeSubDomains; preload"
#>   .. .. ..- attr(*, "class")= chr [1:2] "insensitive" "list"
#>  $ cookies    :'data.frame':	0 obs. of  7 variables:
#>   ..$ domain    : logi(0) 
#>   ..$ flag      : logi(0) 
#>   ..$ path      : logi(0) 
#>   ..$ secure    : logi(0) 
#>   ..$ expiration: 'POSIXct' num(0) 
#>   ..$ name      : logi(0) 
#>   ..$ value     : logi(0) 
#>  $ content    : raw [1:11493] 7b 22 64 6f ...
#>  $ date       : POSIXct[1:1], format: "2022-12-08 11:56:48"
#>  $ times      : Named num [1:6] 0 0.0568 0.0756 0.16 1.7616 ...
#>   ..- attr(*, "names")= chr [1:6] "redirect" "namelookup" "connect" "pretransfer" ...
#>  $ request    :List of 6
#>   ..$ method    : chr "GET"
#>   ..$ url       : chr "https://api.figma.com/v1/files/Y7jJJ5KHcG7hjuZVeRPZWq"
#>   ..$ fields    : NULL
#>   ..$ options   :List of 2
#>   .. ..$ useragent: chr "libcurl/7.64.1 r-curl/4.3.3 httr/1.4.4"
#>   .. ..$ httpget  : logi TRUE
#>   ..$ auth_token: NULL
#>   ..$ output    : list()
#>   .. ..- attr(*, "class")= chr [1:2] "write_memory" "write_function"
#>   ..- attr(*, "class")= chr "request"
#>  $ handle     :Class 'curl_handle' <externalptr> 
#>  - attr(*, "class")= chr "response"