From bc4419d22a145a7741bda9a01b5913dcd2f2cc30 Mon Sep 17 00:00:00 2001 From: "Jocelyn Badgley (Twipped)" Date: Thu, 28 Oct 2021 11:19:27 -0700 Subject: [PATCH] Changed tweet entity layout to match the way it presents on Twitter --- scss/_markup.scss | 4 ++++ scss/_tweet.scss | 20 ++++++++++++++++---- thread.js | 21 +++++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 thread.js diff --git a/scss/_markup.scss b/scss/_markup.scss index cfffd95..aafc0ae 100644 --- a/scss/_markup.scss +++ b/scss/_markup.scss @@ -142,6 +142,10 @@ $cwColor: darken($gray-100, 2%); margin: 0 -1rem 1em; + &:first-child { + margin-top: -1rem; + } + padding: 10px 20px; background-color: $cwColor; color-adjust: exact; diff --git a/scss/_tweet.scss b/scss/_tweet.scss index 6a5b583..9a40b64 100644 --- a/scss/_tweet.scss +++ b/scss/_tweet.scss @@ -247,12 +247,24 @@ grid-column-end: span 2; } - &.entity-count-2 .tweet-entity { - grid-row-end: span 2; + &.entity-count-2 { + .tweet-entity { + grid-row-end: span 2; + } + + .tweet-entities-inner { + padding-bottom: 45%; + } } - &.entity-count-3 .tweet-entity:first-child { - grid-row-end: span 2; + &.entity-count-3 { + .tweet-entities-grid { + grid-template: 1fr / 1fr 1fr 1fr; + } + + .tweet-entities-inner { + padding-bottom: 30%; + } } } diff --git a/thread.js b/thread.js new file mode 100644 index 0000000..461b52c --- /dev/null +++ b/thread.js @@ -0,0 +1,21 @@ +/* eslint no-console:0, no-process-exit:0 */ + +const argv = require('minimist')(process.argv.slice(2)); +const thread = require('./build/twitter-thread'); + +const [ tweet ] = argv._; +thread(tweet).then( + ([ embeds, dependencies ]) => { + console.log(dependencies.map((id) => `\n - '${id}'`).join('')); + console.log(` +{!{ +{{import '~/tweet' ids=[${embeds.map((id) => `\n '${id}'`).join('')} +] tweets=meta.tweets className="oneblock card span2 left" }} +}!} +`); + process.exit(0); + }, (err) => { + console.error(err); + process.exit(1); + }, +);