This project provides a badge for sharing your current book in your github profile.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.3 KiB

4 years ago
4 years ago
  1. <svg width="800" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  2. <foreignObject width="800" height="200">
  3. <div xmlns="http://www.w3.org/1999/xhtml" class="container">
  4. <style>
  5. div {
  6. font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;
  7. }
  8. .main {
  9. display: flex;
  10. flex-wrap: wrap;
  11. justify-content: center;
  12. gap: 20px; /* Optional: Adds spacing between book items */
  13. }
  14. .book-item {
  15. display: flex;
  16. flex-direction: column;
  17. align-items: center;
  18. justify-content: space-between; /* Ensures titles are at the bottom */
  19. width: 150px; /* Adjust to fit your needs */
  20. box-sizing: border-box;
  21. }
  22. .container {
  23. border-radius: 5px;
  24. padding: 10px 10px 10px 0px;
  25. }
  26. .reading {
  27. font-weight: bold;
  28. color: #53b14f;
  29. text-align: center;
  30. display: flex;
  31. justify-content: center;
  32. align-items: center;
  33. }
  34. .not-read {
  35. color: #ff1616;
  36. }
  37. .art {
  38. width: 100%;
  39. display: flex;
  40. justify-content: center;
  41. margin-bottom: auto; /* Pushes the text to the bottom */
  42. }
  43. .cover {
  44. border-radius: 2px;
  45. max-height: 200px; /* Fixed height for book covers */
  46. width: auto; /* Maintains aspect ratio */
  47. display: block;
  48. }
  49. .text {
  50. text-align: center;
  51. margin-top: auto; /* Ensures the text stays at the bottom */
  52. }
  53. .book {
  54. font-size: 18px;
  55. color: #666;
  56. }
  57. .author {
  58. font-size: 14px;
  59. color: #b3b3b3;
  60. margin-top: 3px;
  61. }
  62. .logo {
  63. margin-left: 5px;
  64. margin-top: 5px;
  65. }
  66. </style>
  67. <div class="main">
  68. {% if books|length > 0 %}
  69. {% for book in books %}
  70. <div class="book-item">
  71. <center>
  72. <a class="art" href="" target="_BLANK">
  73. <img src="data:image/png;base64, {{ book.img }}" class="cover" />
  74. </a>
  75. </center>
  76. <div class="text">
  77. <div class="book">{{ book.title }}</div>
  78. <div class="author">by {{ book.author }}</div>
  79. </div>
  80. </div>
  81. {% endfor %}
  82. {% else %}
  83. <div class="reading not-read">Nothing on Goodreads</div>
  84. {% endif %}
  85. </div>
  86. </div>
  87. </foreignObject>
  88. </svg>