Created
August 5, 2022 14:07
-
-
Save jthomasmock/7f58cfc7b081e261cfa5503bb6cceb15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| format: revealjs | |
| engine: knitr | |
| --- | |
| ## Cards, on a page | |
| ```{css, echo=FALSE} | |
| .card { | |
| /* Add shadows to create the "card" effect */ | |
| box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); | |
| transition: 0.3s; | |
| width: 200px; | |
| float: left; | |
| margin: 5px; | |
| } | |
| /* On mouse-over, add a deeper shadow */ | |
| .card:hover { | |
| box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2); | |
| } | |
| /* Add some padding inside the card container */ | |
| .container .card{ | |
| padding: 2px 16px; | |
| } | |
| ``` | |
| ```{=html} | |
| <div class = "container" style = "display: block; width: 100%;"> | |
| <div class="card"> | |
| <img src="https://pbs.twimg.com/profile_images/1550513632940904460/BVHnaWhq_400x400.jpg" alt="Avatar" style="width:100%"> | |
| <div class="container"> | |
| <h4><b>John Doe</b></h4> | |
| <p>Architect & Engineer</p> | |
| </div> | |
| </div> | |
| <div class="card"> | |
| <img src="https://pbs.twimg.com/profile_images/1550513632940904460/BVHnaWhq_400x400.jpg" alt="Avatar" style="width:100%"> | |
| <div class="container"> | |
| <h4><b>John Doe</b></h4> | |
| <p>Architect & Engineer</p> | |
| </div> | |
| </div> | |
| </div> | |
| ``` | |
| ## Card, R code | |
| ```{r} | |
| create_card <- function(img, name, title){ | |
| glue::glue('<div class = "container" style = "display: block; width: 100%;"> | |
| <div class="card"> | |
| <img src="{img}" alt="Avatar" style="width:100%"> | |
| <div class="container"> | |
| <h4><b>{name}</b></h4> | |
| <p>{title}</p> | |
| </div> | |
| </div>') |> | |
| knitr::raw_html() | |
| } | |
| ``` | |
| ## Card, generated by R | |
| ```{r} | |
| #| results: asis | |
| create_card("https://pbs.twimg.com/profile_images/1550513632940904460/BVHnaWhq_400x400.jpg", | |
| "Tom Mock", | |
| "Customer Enablement") | |
| create_card("https://pbs.twimg.com/profile_images/1550513632940904460/BVHnaWhq_400x400.jpg", | |
| "Tom Mock", | |
| "Customer Enablement") | |
| create_card("https://pbs.twimg.com/profile_images/1550513632940904460/BVHnaWhq_400x400.jpg", | |
| "Tom Mock", | |
| "Customer Enablement") | |
| ``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment