diff --git a/CHANGELOG.md b/CHANGELOG.md index fd5d5a1..36cd7f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.1.2] - 2024-06-09 + +- drop unused paragraph `Support us with crypto donations`. Feel free to use your own text. +- added some CSS and JS to make it more handy +- added copy address button +- added show QR with the address button +- make some refactoring 🤓 + ## [0.1.1] - 2024-06-07 - add conditional view of donation crypto currences diff --git a/Gemfile.lock b/Gemfile.lock index 8120398..359dc9c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - jekyll-crypto-donations (0.1.1) + jekyll-crypto-donations (0.1.2) jekyll (~> 4.3) GEM diff --git a/assets/css/crypto-donations/crypto-donations.css b/assets/css/crypto-donations/crypto-donations.css new file mode 100644 index 0000000..5614850 --- /dev/null +++ b/assets/css/crypto-donations/crypto-donations.css @@ -0,0 +1,116 @@ +#jekyll-crypto-donations { + font-family: Arial, sans-serif; + margin: 20px 0; + color: var(--text-primary); + padding: 30px 20px 20px; + text-align: center +} + +.jekyll-crypto-donations__title { + font-family: CharterC,sans-serif; + font-size: 32px; + font-weight: 700; + line-height: 38px +} + +.jekyll-crypto-donations__item { + border: 1px solid var(--text-color); + padding: 10px; + margin-bottom: 10px; + border-radius: 5px; + margin-top: 24px +} + +.jekyll-crypto-donations__crypto-name { + font-weight: bold; + margin-bottom: 5px; +} + +.jekyll-crypto-donations__crypto-code span { + font-family: monospace; + background:var(--background-color); + padding: 5px; + border-radius: 3px; + display: inline-block; +} + +.jekyll-crypto-donations__crypto-buttons { + margin-top: -10px; +} + +.jekyll-crypto-donations__button:hover { + color: var(--text-primary)!important +} + +@media (min-width: 885px) { + .jekyll-crypto-donations__button { + font-size:14px + } +} + + +.jekyll-crypto-donations__crypto-btn-copy, +.jekyll-crypto-donations__crypto-btn-qr { + border: none; + padding: 5px 10px; + margin-right: 5px; + fill: var(--text-color); + background: none; + height: 20px; + opacity: .5; + transition: opacity .2s ease; + width: 20px +} + +.jekyll-crypto-donations__crypto-btn-copy:hover, +.jekyll-crypto-donations__crypto-btn-qr:hover { + opacity: 1 +} + +.jekyll-crypto-donations__button>* { + position: relative +} + +.jekyll-crypto-donations__button:active:before { + background-color: var(--background-color) +} + +.jekyll-crypto-donations__button:hover:before { + opacity: 1 +} + +.jekyll-crypto-donations__button:before { + background-color: var(--background-color); + border-radius: inherit; + content: ""; + height: 100%; + left: 0; + opacity: 0; + position: absolute; + top: 0; + transition: opacity .3s ease; + width: 100% +} + +.jekyll-crypto-donations__crypto-image-qr { + display: none; +} + +.jekyll-crypto-donations__crypto--show-qr .jekyll-crypto-donations__crypto-image-qr { + display: inline-block; +} + +.jekyll-crypto-donations__crypto-code--is-copied span { + display: none; + text-align: center +} + +.jekyll-crypto-donations__crypto-code--is-copied:before { + color: var(--text-color); + content: "Copied!"; + font-family: monospace; + background: var(--background-color); + padding: 5px; + border-radius: 3px; + display: inline-block; +} diff --git a/lib/jekyll-crypto-donations.rb b/lib/jekyll-crypto-donations.rb index a0bf2c5..6ecae9c 100644 --- a/lib/jekyll-crypto-donations.rb +++ b/lib/jekyll-crypto-donations.rb @@ -7,48 +7,104 @@ module Jekyll module CryptoDonations # describe {% crypto_donations %} tag content - class DonationsTag < Liquid::Tag + class DonationsTag < Liquid::Tag # rubocop:disable Metrics/ClassLength attr_reader :btc_address, :eth_address, :usdt_address + CRYPTO_CURRENCIES = { + btc: { name: "Bitcoin", ticker: "BTC" }, + eth: { name: "Ethereum", ticker: "ETH" }, + usdt: { name: "Tether", ticker: "USDT TRC-20" } + }.freeze + def initialize(tag_name, text, tokens) super @text = text end - def btc_html - return "" unless btc_address - + def currency_html(currency_ticker, address) + currency = CRYPTO_CURRENCIES[currency_ticker] <<~HTML -
Address: #{btc_address}
-Loading...
+Address: #{eth_address}
-Loading...
-Address: #{usdt_address}
-Loading...
-#{@text}
+