Last active
April 19, 2024 21:06
-
-
Save esafwan/fb39e5230aa544ffe6f24d56832fd5c7 to your computer and use it in GitHub Desktop.
Typst catlog
This file contains 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
#let img(image_path, img_width: auto, img_height: auto, img_alt: none, img_fit: "cover") = [ | |
#image(image_path, width: img_width, height: img_height, alt: img_alt, fit: img_fit) | |
] | |
#let fig(image_path, img_width: auto, img_height: auto, img_alt: none, img_fit: "cover", img_caption: none) = [ | |
#figure( | |
image(image_path, width: img_width, height: img_height, alt: img_alt, fit: img_fit), | |
caption: [ | |
img_caption | |
] | |
) | |
] |
This file contains 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
//Set page to A4 Size and margin auto | |
#set page(paper: "a4", margin: 40pt) | |
#import "component/img.typ": img | |
#let products = json("data/products.json") | |
#let cols = 4 //no of cols | |
#grid( | |
columns: (1fr,)* cols , | |
// Equal fraction of available width for each column | |
rows: (auto), | |
// 1cm height for each row | |
gutter: 1pt, | |
// Space between cells | |
stroke: black.transparentize(99%), | |
align: center + horizon, | |
..products.map(product => [ | |
#img("../img/"+product.image, img_width: auto, img_height: 100pt, img_fit: "contain" ) | |
== #product.title \ | |
#product.price \ \ | |
]) | |
) |
This file contains 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
[ | |
{"image": "1.png", "title": "Comfortable Chair", "price": "149.99"}, | |
{"image": "2.png", "title": "Sturdy Table", "price": "249.99"}, | |
{"image": "3.png", "title": "Bright Lamp", "price": "89.99"}, | |
{"image": "4.png", "title": "Interesting Book", "price": "5.99"}, | |
{"image": "1.png", "title": "Comfortable Chair", "price": "149.99"}, | |
{"image": "2.png", "title": "Sturdy Table", "price": "249.99"}, | |
{"image": "3.png", "title": "Bright Lamp", "price": "89.99"}, | |
{"image": "4.png", "title": "Interesting Book", "price": "5.99"}, | |
{"image": "1.png", "title": "Comfortable Chair", "price": "149.99"}, | |
{"image": "2.png", "title": "Sturdy Table", "price": "249.99"}, | |
{"image": "3.png", "title": "Bright Lamp", "price": "89.99"}, | |
{"image": "4.png", "title": "Interesting Book", "price": "5.99"} | |
] |
Author
esafwan
commented
Apr 19, 2024
![Screenshot 2024-04-20 at 2 32 00 AM](https://private-user-images.githubusercontent.com/246454/324116208-962a21b0-335f-40f7-b8f5-0f173bfa2828.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NDQ3MTEsIm5iZiI6MTcyMTc0NDQxMSwicGF0aCI6Ii8yNDY0NTQvMzI0MTE2MjA4LTk2MmEyMWIwLTMzNWYtNDBmNy1iOGY1LTBmMTczYmZhMjgyOC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyM1QxNDIwMTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lNGM5OGYyMWE2OThkYzYwNjc5ZWQ2ZTZjNTcyNGVjMjlmMzRiZjQ1YWFkZGE5MDA3NTI0NDFlMWY2ZjRkZmU5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.p36PpL8v7fYhhxr0LFnRkMzzOZa5PWFb1actjKsa_gQ)
![image](https://private-user-images.githubusercontent.com/246454/324116314-0946a9cc-8222-4185-81da-cad00c0beb35.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NDQ3MTEsIm5iZiI6MTcyMTc0NDQxMSwicGF0aCI6Ii8yNDY0NTQvMzI0MTE2MzE0LTA5NDZhOWNjLTgyMjItNDE4NS04MWRhLWNhZDAwYzBiZWIzNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyM1QxNDIwMTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02NWMwNjdlYTVhMzRmNTJhNTIwODZkMWExNGQzNDEwYzg1ZDgyZTFlMGQzYWU2NGQwOWJjNjg4NDg3OTk1OWI0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.4rircSK44xgqpgAFMsLH0DV3k2WTK9ZbysMxTKPL7zk)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment